You are not logged in.

#1 2009-03-11 03:37:03

Tg
Member
Registered: 2008-04-23
Posts: 35

Behavior of alias (bash script)?

Hi

I just install sun-jre on the box but I have little problem with it a little bit...

I has this in my .bashrc (I don't have root access so I install in /home folder and use alias)

#.bashrc
alias sunjava=/home/preecha/local/jre1.6.0_12/bin/java

This "sunjava" ran fine when I call from bash prompt but when I used another bash script calling it.

#!/bin/sh
#cytoscape.sh
sunjava -Dswing.aatext=true -Xss5M -Xmx512M -jar cytoscape.jar cytoscape.CyMain -p plugins "$@"

When I run .cytoscape.sh, the error occur.

./cytoscape.sh: line 9: sunjava: command not found

(but I can call this line without problem in bash prompt...)

Am I doing it wrong or missing something ?. Any suggestion would be really appreciate.

Last edited by Tg (2009-03-11 03:40:34)

Offline

#2 2009-03-11 04:08:28

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: Behavior of alias (bash script)?

from man bash:

Aliases  are not expanded when the shell is not interactive, unless the
expand_aliases shell option is set using shopt (see the description  of
shopt under SHELL BUILTIN COMMANDS below).

Offline

#3 2009-03-11 06:55:02

Tg
Member
Registered: 2008-04-23
Posts: 35

Re: Behavior of alias (bash script)?

hbekel wrote:

from man bash:

Aliases  are not expanded when the shell is not interactive, unless the
expand_aliases shell option is set using shopt (see the description  of
shopt under SHELL BUILTIN COMMANDS below).

I see. Thanks for replying.

Offline

#4 2009-03-11 19:44:50

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Behavior of alias (bash script)?

there's also the info file which should be a bit easier to understand..(pinfo gives you info with colors if you care)


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#5 2009-03-11 22:16:40

klixon
Member
From: Nederland
Registered: 2007-01-17
Posts: 525

Re: Behavior of alias (bash script)?

just stash this in your .bashrc and you'll be fine. No need for that alias after this

PATH=${PATH}:/home/preecha/local/jre1.6.0_12/bin/

You could also put the path to your local java at the start to give yours preference over another java implementation installed on the box somewhere...

Last edited by klixon (2009-03-11 22:18:43)


Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!

Offline

#6 2009-03-11 22:46:44

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Behavior of alias (bash script)?

I love all of klixon's posts..it's like reading Edgar Allan Poe's 'The Raven'; eloquent, concise and beautiful.

Offline

#7 2009-03-11 22:49:48

klixon
Member
From: Nederland
Registered: 2007-01-17
Posts: 525

Re: Behavior of alias (bash script)?

Thanks big_smile


Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!

Offline

#8 2009-03-16 12:44:45

Tg
Member
Registered: 2008-04-23
Posts: 35

Re: Behavior of alias (bash script)?

klixon wrote:

just stash this in your .bashrc and you'll be fine. No need for that alias after this

PATH=${PATH}:/home/preecha/local/jre1.6.0_12/bin/

You could also put the path to your local java at the start to give yours preference over another java implementation installed on the box somewhere...

well thanks for that, But admin already has alias the "java"  to other command for some... who knows reason, so I'm a bit worrying if there'll be a conflict.

Last edited by Tg (2009-03-16 12:45:09)

Offline

Board footer

Powered by FluxBB