bash is no better (or worse) than dash - just different. Every UNIX system has some default shell, which you can reach under "/bin/sh". In many Linux-variants this is bash (RedHat-based variants, Slackware, ....), in some others (debian-based variants) it is dash, and in my beloved IBM AIX Unix it is a ksh88.
This is why you can specify explicitly by which shell your script should be run using the "shebang", as it is called: if the absolute first 2 bytes of an executable file are "#!" then the named executable following this is run and fed the following text as input.
means: load "/bin/bash" and feed it the rest of the text as input. You can even force the system to use your own version if you want to try something with a special version you installed:
and you can specify any other executable as well, for instance awk:
I hope this helps.
bakunin
Thank you for the well though out explanation, I really appreciate you taking the time to write it. As someone who only dabbles in Linux very occasional it can get very daunting
---------- Post updated at 08:29 AM ---------- Previous update was at 08:28 AM ----------
Quote:
Originally Posted by Scrutinizer
dash may have less functionality than bash but it is a POSIX compliant and it is smaller and faster than bash, so systems startup scripts will run faster which leads to shorter boot times for example..
And now I know what POSIX means, thanks to Google. This has been a very informative thread, thank you!
Hey guys i need help i have a script to push a password to a remote server the only problem is the $ENCRYPT variable has $'s in it (from the encrypted password in the shadow file) and they drop out when apending to the shadow file via the usermod command so
$1$Q/6a08n$EoAcBuR/YnoCQC shows up as... (3 Replies)
Hi,
I have a script where I am trying to set a local variable using the following,
MYVAR="$NAME"_"$NAME2".txt
where say,
NAME = one
NAME2 = two
so I want the output one_two.txt but what I am getting is,
two.txt
basically the $NAME2 is overwriting, what am I doing wrong?
... (3 Replies)
Hi, I am trying to unzip a file( $pfile, it contains a couple of files and 4 folders with subfolders and files) and have its contents go into a directory instead of into a folder in that directory (ZZZZ), I have the following script:
#Unzip the build
unzip -o "$HOME/ZZZZ/$pfile" -d... (2 Replies)
Dear All,
we have a command output which looks like :
Total 200 queues in 30000 Kbytes
and we're going to get "200" and "30000" for further process. currently, i'm using :
numA=echo $OUTPUT | awk '{print $2}'
numB=echo $OUTPUT | awk '{print $5}'
my question is : can I use just one... (4 Replies)
I am facing a problem while storring the grep results into a variable. I need to count the occurence of the pattern \, in a file and store that in a variable. I have given the below command
p=`grep -c '\\,' filename`
But while echoing the variable, i am getting the total number of lines in... (2 Replies)
Hi, I'm new to these forums, and I'm hoping that someone can solve this problem...
To make things short:
I have DD-wrt set up on a router.
I'm trying to run a script in CRON that fetches the daily password from my database using SSH.
CRON is set like so(in web interface):
* * * *... (4 Replies)
Hi All,
I'm trying to run a similar script to copy a files from one location to another.
#!/bin/bash
source="/home/pradeepk/a.txt"
destination="/home/pradeepk/dir1"
cp $source $destinationi'm getting following error.
cp: cannot stat `/home/pradeepk/a.txt\r': No such file or directorywhen... (1 Reply)
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk... (2 Replies)
I need help with one of my shell script. The script is working fine but i need to add two condition -
i need to get rid of all the below ftp messages and need to have only ftp completed or failed message.
example when i run the script i get below lines -
Connected to xxxx
220 (vsFTPd... (1 Reply)
I have the following script, and I want to assign the output ($10 and $5) from awk to N and L:
grdinfo data.grd | awk '{print $10,$5}'| read N L
output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)