I have started writing one script. It is not taking the if block.
Here is the script:
#!/bin/sh
set USER='/usr/ucb/whoami'
#######################################################################
#Killing Process
#######################################################################
echo "$USER"
if ("$USER"=="akaur1")
then
echo 'killing process' >> /apps/jate/qisscript.log
#elif ( "$USER" == "qisadmin")
#then
#sudo /etc/init.d/jatedaemon.sh stop
fi
When I run this, it is displaying akaur1 at starting, but after that it is giving: TEST_SCRIPT.sh: akaur1: not found
Please help
panyam
2
something like this :
if [ $user == "akura1" ];
then
.........
else
........
fi
Still same error:
TEST_SCRIPT.sh: [akaur1==akaur1]: not found
You need a space after [ and before ].
I put a space before and after, now its giving,
TEST_SCRIPT.sh: [akaur1: not found
panyam
6
Sorry , it should be :
if [ $user = "akura1" ];
then
.........
else
........
fi
Hi,
Pleas chk it out. and you have use single "=" only.
#!/bin/sh
set USER=`/usr/ucb/whoami`
#######################################################################
#Killing Process
#######################################################################
echo "$USER"
if [ "$USER" = "akaur1" ]
then
echo 'killing process' >> /apps/jate/qisscript.log
#elif ( "$USER" == "qisadmin")
#then
#sudo /etc/init.d/jatedaemon.sh stop
fi