Link to home
Start Free TrialLog in
Avatar of hyder
hyder

asked on

how to create a .sh file to execute a series of commands

Hi,

   I have some set of commands to execute frequently, when i keep each command in separate file with extension .sh and try to run them they were working fine. But when i try to put them together they were not working , i am new to unix/solaris pls give me tips on this.

Example
CLASSPATH=$CLASSPATH:/xyz/abc.jar
export CLASSPATH
java Main

thanks,
KK

ASKER CERTIFIED SOLUTION
Avatar of liddler
liddler
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hyder
hyder

ASKER

Hi,

 Thanks for the response. I tried and its working fine. I am basically looking to have a .sh file to set ANT_HOME and run it before i run the ant scripts.

I wrote the file
#!/bin/ksh
ANT_HOME='/sabc/mydir/apache-ant'
export ANT_HOME
echo $ANT_HOME

when i run the above file i am able to see the ANT_HOME  value set. But after this when i tried to type the value of ANT_HOME again it is empty. I am doining this in the same session. I believe its opening a new shell to run the script and not reflecting the values to the parent shell. Pls suggest how to overcome this issue.

/>test.sh
/sabc/mydir/apache-ant
/>echo $ANT_HOME
/>
thanks,
H
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial