Greetings, using ksh on Solaris, I am trying to identify the current version of a package installed on multiple servers using if statement in a precursor to upgrading.
I have searched the forums and have found many hits, reviewed 3 pages and have tried the different variations noted there. Also checked the site, Bourne/Korn Shell Coding Conventions at OpenSolaris.org to validate operators and syntax, yet I am not getting this to work.
I have tried the following variations and all return some error, most commonly:
TFM - the echo is just for my precursor test, I will fill with exit or pkgrm and pkgadd based on results.
As for the syntax with = and "1.11", I am still getting the error with the following 2 other attempts:
For comparison, here are the results of the separate commands on my test server:
I figured it out after checking another one of my test using commands. Since I am echo the command results, I actually need to capture the echo as my command and test that. So, more capture the echo command and escape the commands within the echo.
Please can you help me understand the significance of providing arguments under sh -s in
> ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
O/S solaris 9
shell ksh
if
then
chk_op="WARNING...reboot within the last 24hrs, restarted at `who -r | awk '{print $4$5"@"$6}'`" ;
else
if ;
then
last_reboot1=`who -b | awk '{print $4" "$5" "$6}'`
last_reboot2='..OK..'`uptime | awk '{print$3" "$4}'`
... (4 Replies)
Hi ,
Os - Solaris
Shell - Ksh
I am getting below error in if condition
+ id
+
./om_wf_complete.sh: gid=4081(Infadmn): unknown test operator
+ exit 1
if ; then
touch /home/odwt/1.0.0/out/oworkflow.dat
chmod 777 /home/odwt/1.0.0/out/oworkflow.dat
elif ; then
touch... (8 Replies)
Hi
I am trying to figure out what the following line does, I work in ksh88:
] && LIST="$big $LIST"
Not sure what "-a" means in that case.
Thanks a lot for any advice -A (1 Reply)
Im trying to check if a series of directory exists and if not create them, and am having issues. All the instances of test return with the error "test:
#!/bin/bash
location_Parent=~/Documents/sight_of_sound
location_IMG=~/Documents/Sight_of_sound/IMG
location_AUD=~/Documents/Sight_of_sound/AUD... (4 Replies)
hi all, i am using the below command in my script
if ; then
This statement is causing the problme "ScriptName.ksh: XXX-XXX: unknown test operator"
could you please suggest me , how can i avoid these messages.
Singhal (7 Replies)
Hi All,
can some one figure out the syntax issue here. How to overcome this?
#!/bin/sh
$ HFR_MAIL=NO
$ PRP_MAIL=NO
$ MC_MAIL=NO
$ if && && ]; then
> echo "NO "
> else
> echo "YES"
> fi
test: unknown operator NO
$ if && && ]; then
> echo "NO"
> else
> echo "YES"
>... (4 Replies)
hi
I get test: unknown operator status
if
then
echo "OK."
return 0
else
echo "not ok" 2>&1
exit -1
fi
I tried to change "A" with 'A' --> same error
I tried to change
if , I am getting: (3 Replies)
Hi,
I have the following shell script :
Nbr_BD_Link=0
Nbr_BD_Link=`
sqlplus sysadm/${PSWD}@${DB_Name} << EOF | tail -4 | head -1 2>/dev/null
set head off feedback off ;
select count(*) from dba_db_links ;
exit ;
EOF `
echo ${Nbr_BD_Link}
if ; then
... (4 Replies)
I have gotten the script up to this point and it works fine a system but when i copy it to another unix server running solaris 9 as the original one , its gives an error './mon_fs.sh: 0: unknown test operator' .
(see script bellow)
can the Gurus see to this as i am just a beginner with... (2 Replies)