Question

I have a usage in which I have to open a new tcsh. I want the aliases set on the current shell to be available also in the new tcsh shell. It is not done by default and I wanted to know if there's a way to let it work...

Here's how my problem looks:

> alias hello pwd
> hello
/home/user123
> tcsh
> hello
hello: Command not found.

** Edit **

I just wanted to clarify that I don't want to add the aliases to ~/.aliases, as they should be defined in a specific shell, and not in any new shell I open. I want them to be "inherited" like environment variables.

Is it possible anyway?

Thanks!

Was it helpful?

Solution

I am answering here with @Mark_Armstrong comment.

It is possible to use the command alias to print all the available aliases, and to save them into a file.

Then you can use some scripting to add a preceding "alias " string to each line in that file, and to "source" it.

Or you can just iterate over the file lines using csh and run alias $line

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top