See this link for an explanation of ./. As for building a script that will run in all shells, I suppose it is possible to do this but I would imagine that it would be difficult to get it right. Some shells, such as csh, are not as full featured as say ksh. The script you are building would have to be built with the lowest common denominator of shell functionality common to all shells.
instead of checking for $SHELL ... just set the first line of the script to "#! /bin/sh" and run it with either ./script_name or /path/to/script_name ...
checking for $SHELL is unnecessary ... you might check for the correct shell path if you are porting the script to different OS platforms (i.e., /bin/ksh for Solaris and /usr/bin/ksh for HP, etc.) but that doesn't sound like that's what you're trying to do here ...
Um, it doesn't work in csh because "if [ $SHELL != /bin/sh ]; then" is not valid csh syntax.
it doesn't matter what shell you are using for your current environment, the script will use the shell you set it to use through the "#!" directive ...
The OP is attempting to write a shell that runs under all shells (not specific to bourne) and by not specifying a magic number in the script.
Again, the script you are building would have to be built with the lowest common denominator of shell functionality common to all shells. As criglerj pointed out, you must exclusively use syntax that is common to all shells to get this project to work.
I appreciate if someone answer this question for my learning purpose:
Given a filename structure of a COUNTRY CODE, file type, date (YYYYMMDD) and two digit attempt number with an extension of ".dat", write a UNIX shells script to echo out the date value.
Example: ... (1 Reply)
Hi,
I am getting the below error
: error at the if condition start and when I print the
value of TEST, it displays two values as below
/home/xyz/out/file1.txt
/home/xyz/out/file2.txt
if ; then
mv $TEST $TARGETDIR/
fi
Tried by enclosing it in double quotes "$TEST",... (4 Replies)
Hi to all,
i have the following problem...
i want to run three commands in a script in different shells... the first command is running always and is needed for the second on to run properly... example
# Procedure 1
xterm -e exec1 arg1 arg2
# Procedure 2
xterm -e exec2 arg1 arg2
#... (6 Replies)
Hi all,
This is the first time i am using expect.
I am trying to call a function with in the shell script. The function will shh to a new server and will pass the password using expect and send. I need help in calling the fuction i am getting follaowing errors...
here the script
... (8 Replies)
Hi,
Getting below error on executing the shell script which initiates sqlplus
How to set oracle enviornment variables in the shell script ?
With Regards (3 Replies)
I have the following script running with nohup on one of my servers:
#!/bin/bash
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#set log number
#i=1
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#Check if log exits, if so incrememnt log number up so we don't clobber
#while... (8 Replies)
Hi
This is the list file that i have :
The files is more than this.
I will rename one by one file become like this :
So just change the time stamp 200906 become 200905.
Is it possible using script ?
Thanks (3 Replies)
Hi,
Is it possible to use multiple shells in one script.
There are sometimes we need to club shell specific commands in single script.
for example in bash mode we use -e with echo to use Escape sequence but in ksh it is not required. How to tell a UNIX command to run in a specific shell.
... (2 Replies)
All
Can you help me to validate a variable only for string and digit. That is
variable should either fully alphabets or digits.
Please send me result to my mail id also: REMOVED
Thanx in advance
Regards
Deepak Xavier (1 Reply)