I am writing a shell script that takes at least 2 arguments. The first is an octal representation of file permissions, the second is a command that is executed on all the files found with that permission.
invoked: ./script.sh 543 ls -la
what I have now works alright, but it assumes that there are no more than 2 options with the command. Also on the system I'm using it ignores the $3 and $4 if not further arguments were passed, but this is poor style and I'm guessing some systems may get messed up.
I tried
but this didn't work.
Is my question clear or should I clarify?
Thanks for the help.
In order to avoid possible future trouble with parameters that contain non-alphanumerical characters. Perhaps some of the double quotes are superfluous in this case.
Hey everyone
can you check this script logic ?
it has to restart webservice if found server load is higher than X,
also i have put it in crontab to run every one minute
#!/bin/bash
loadavg=$(uptime | awk -F "." '{ print $1 }' | awk -F ":" '{ print $5 }')
if ; then
pkill -9 httpd
service... (7 Replies)
lets explain it easy by showing the initial file and desired file:
I've a file such this that contains:
initial_file:
31/12/2011 23:46:08 38.6762 43.689 14.16 Ml 3.1
... (1 Reply)
Hi all,
I need some help with a script I would like to amend.Let's say it's a simple script like the one below
controls=`grep line /etc/file |grep -v "^#"| awk -F":" '{print $4}'`
for cc in $controls
do
echo $cc
sleep 2
done
cc variable holds a list of 40 numbers.... (2 Replies)
in /etc/init.d/networking of an ubuntu computer, I found this code:
if ifdown -a --exclude=lo; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
Shouldn't it be replace by
ifdown -a --exclude=lo
... (0 Replies)
hi Gurus, please why is this happening:
when i run this:
#!/bin/bash
declare -a name
declare -a ph
declare -a eid
r=0;
c=1;
i=1;
n=;
echo " name phone email_id"
while :
do
#if ; then
#break;
#else
echo -n "field $i:"; read name ph eid;
let "i++";
... (5 Replies)
Hi..
When i refered the script /etc/rc.sysinit...
i found the "action commands" like
But this is not working in my shells..
the following error is coming...
Please anybody help
Thanks in advance
esham (5 Replies)