Welcome to iraf.net Tuesday, April 23 2024 @ 11:37 AM GMT
sapna |
02/23/2016 06:03PM (Read 1517 times)
|
|
|
Status: offline
Registered: 01/03/2016
Posts: 13
|
hello all,
I have made some alias for few commands in my shell .bashrc file( eg. alias c='clear', alias l='ls' etc) when I open xgterm window and in ecl prompt when i type
cl\$this->_split2($m[0]) !l
I get error /bin/bash: l: command not found.
Is there any way I can use shell alias inside my ecl prompt ????/
|
|
|
|
fitz |
02/23/2016 08:47PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
It can be done, but not easily.
The CL allows for two OS escape commands: a single '!' escape will execute the command using whatever your default shell is or the shell named by your SHELL environment variable, a double '!!' will force the use of /bin/sh. The libc execl() function is used to spawn the command (in os$zoscmd.c) but since the $SHELL value isn't parsed for multiple arguments you can't simply define $SHELL to include a '-l' or '-i' to force it to read startup files and pickup the alias. Instead, you need to create a script something like
PHP Formatted Code
#!/bin/bash -i
/bin /bash -i -c $ @
and call it say 'myshell' in your home directory and make it executable. Then do an "export SHELL=/home/fitz/myshell" before logging into the CL. The two "-i" flags are required in the script (for different reasons) but will force your .bashrc file to be read and the commandline arguments will be executed.
If you have an alias such as "alias foo=/bin/ls" in your .bashrc file the IRAF escape command "!foo" should then work. Note however there are often IRAF equivalents for many commands or in some cases it may be better to write your own CL script do to what you want.
|
|
|
|
sapna |
02/26/2016 06:01AM
|
|
|
Status: offline
Registered: 01/03/2016
Posts: 13
|
my alias:
alias xgs='xgterm -sb &'
In my bashrc file I did: export SHELL=/home/cs/myshell
myshell file:
#!/bin/bash -i
/bin/bash -i -c $@ I
I made this file executable as suggested by you.
But funny thing is happening that when I am typing xgs on my terminal xgterm window is appearing for 1 sec and it is just after that getting disappeared. I don't know what went wrong when I am removing this export part from my bashrc file xgterm window is opening on typing xgs only.
For the very first time when I added myshell my xgterm window got opened and all my remaining aliases where running in ecl prompt.
But after then xgterm is not opening.
|
|
|
|
| |
|
Content generated in: 0.17 seconds |
|