Welcome to iraf.net Tuesday, April 23 2024 @ 11:37 AM GMT


 Forum Index > Help Desk > Systems New Topic Post Reply
 IRAF ALIAS
   
sapna
 02/23/2016 06:03PM (Read 1517 times)  
+----
Newbie

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 ????/

 
Profile Email
 Quote
fitz
 02/23/2016 08:47PM  
AAAAA
Admin

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.

 
Profile Email
 Quote
sapna
 02/26/2016 06:01AM  
+----
Newbie

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.

 
Profile Email
 Quote
   
Content generated in: 0.17 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login