Home » Infrastructure » Linux » script not working in RedHat Linux.
script not working in RedHat Linux. [message #250998] Thu, 12 July 2007 02:43 Go to next message
Messages: 91
Registered: December 2005
Location: INDIA
Hi All,

The following script checks whether the filename is correct then the script proceeds to check whether you have read,write and execute permisiions to the file and displays an approriate message.

#usage ss23

echo "enter any filename \c"
read fname
if[!-z "$fname"] then
 if [-r $fname -a -w $fname -a -x $fname]
    echo you have read,wirte and execute permisions to $fname
    echo read,write and execute permisions denied

   echo improper filename

when i run this script and give the filename 'test' it is showing the following error.

s23:line 3: if[!-z test]: command not found
s23:line 4: if [-r test -a -w $fname -a -x test] : command not found
s23:line 5:syntax error near unexpected token 'then'

i have seen this program in a shell scripting book and tried it but it has shown the above said error. '-z ' returbs true if the lenght of the string is zero. what would be the equivalent command in Redhat linux. I am using Redhat llinux 9 version.

Please advice.

Re: script not working in RedHat Linux. [message #251157 is a reply to message #250998] Thu, 12 July 2007 09:48 Go to previous message
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
it would not like this
Previous Topic: step to shutdown/startup database in Linux server
Next Topic: no alert log after DB creation
Goto Forum:

Current Time: Tue May 28 20:57:35 CDT 2024