Are "exp" and "imp" binary programs, shell scripts, or oracle procedures?
Do the "$" parameters to "exp" and "imp" come from the shell parameters or are they part of the syntax. If they are between single quote characters they will not be substituted by shell.
Btw. Your main syntax errors are because you have not declared shell procedures correctly.
For example (one of three places with the problem):
and $2 variable is password
as $2 is password and contains abc123$ password i am unable to login invaild password due to $(symbol), how can i bypass or other way to pass abc123$ for that variable
and $2 variable is password
as $2 is password and contains abc123$ password i am unable to login invaild password due to $(symbol), how can i bypass or other way to pass abc123$ for that variable
Use double quotes on your exp call ($ vars are expanded when within double quotes but are kept as-is in single):
Hi Below script is throwing an exception elfi not correct at line no 21.
Can you please have a look at script and advice what is wrong in below script?
Code:
echo "1.FILE PERMISSION"
echo "2.FILE INODE NUMBER"
echo "3.FILE SIZE"
echo "4.FILE OWNER"
echo " Enter what do you want from the option"
read num
if [ $num -eq 1 ]
echo " Enter filename you want permissions for : "
read file1
if [ -f $file1 ]
then
echo " FILE PERMISSIONS for $file1 = `ls -ltr $file1 | awk '{print $1}'` "
exit 0
else
echo " FILE NOT FOUND"
exit 1
fi
elif [ $num -eq 2 ]
echo " Enter filename for which you want INODE NUMBER for : "
read file1
if [ -f $file1 ]
then
echo " FILE INODE NUMBER for $file1 = `ls -il $file1 | awk '{print $1}'` "
exit 0
else
echo " FILE NOT FOUND"
exit 2
fi
elif [ $num -eq 3 ]
echo " Enter filename for which you want SIZE : "
read file1
if [ -f $file1 ]
then
echo " FILE INODE NUMBER for $file1 = `ls -ltr $file1 | awk '{print $5}'` "
exit 0
else
echo " FILE NOT FOUND"
exit 3
fi
elif [ $num -eq 4 ]
echo " Enter filename for which you want OWNER for : "
read file1
if [ -f $file1 ]
then
echo " FILE OWNER for $file1 = `ls -l $file1 | awk '{print $9}'` "
exit 0
else
echo " FILE NOT FOUND"
echo 4
fi
else
echo "YOu have not chosen from the list"
exit 0
fi
Last edited by Franklin52; 01-05-2011 at 03:54 AM..
Reason: Please use code tags and indent your code.
There were a number of issues (missing "then", orphaned "elif" , wrong answer displayed etc.). In the end it is much easier to use a "case" statement for the options.
For rapid testing I have surrounded this example menu in a do-done loop and removed lots of "exit" statements. There are now no "else" or "elif" statements in the script which makes it much easier to follow.
Code:
while true
do
echo ""
echo "1.FILE PERMISSION"
echo "2.FILE INODE NUMBER"
echo "3.FILE SIZE"
echo "4.FILE OWNER"
echo " Enter what do you want from the option"
read num
case $num in
1)
echo " Enter filename you want permissions for : "
read file1
if [ ! -f $file1 ]
then
echo " FILE NOT FOUND"
fi
echo " FILE PERMISSIONS for $file1 = `ls -ltr $file1 | awk '{print $1}'` "
;;
2)
echo " Enter filename for which you want INODE NUMBER for : "
read file1
if [ ! -f $file1 ]
then
echo " FILE NOT FOUND"
fi
echo " FILE INODE NUMBER for $file1 = `ls -il $file1 | awk '{print $1}'` "
;;
3)
echo " Enter filename for which you want SIZE : "
read file1
if [ ! -f $file1 ]
then
echo " FILE NOT FOUND"
fi
echo " FILE SIZE for $file1 = `ls -lad $file1 | awk '{print $5}'` "
;;
4)
echo " Enter filename for which you want OWNER for : "
read file1
if [ ! -f $file1 ]
then
echo " FILE NOT FOUND"
fi
echo " FILE OWNER for $file1 = `ls -lad $file1 | awk '{print $3}'` "
;;
*)
echo "You have not chosen from the list"
exit 0
;;
esac
#
done
@gcvinayak
Please start a new thread in future. Just realised that this is a completely different subject.
I'm using the below statements in my script
if && then
sqlplus sysadm/abcdefgh12@${dbarr} @/u1/scripts/ResetPswd.sql
elif then
for idx in 0 1 2 3 4 5 6 7
do
sqlplus sysadm/abcdefgh12@${dbarr} @/u1/scripts/ResetPswd.sql
done
else
exit
fi
It give me... (5 Replies)
Hi
I am reading a book about Fortran 90 and I write the following code, to test my understanding of the first chapter. I have a problem with the last section of the code with deals with an IF, ELSEIF, and GOTO statements. Here is my Code
PROGRAM sim
! This code is used to solve two... (3 Replies)
Hello,
I am relatively new to UNIX scripting and am learning a lot. I have already tried several searches on this website and have tried various syntax options suggested to no avail. I am obviously not writing the script correctly. I really do appreciate any and all the help.
Below is an... (8 Replies)
Hi all,
This is my first post in this forum, can i request you to guide, where i am going wrong with the error below.
34: Syntax error: "fi" unexpected (expecting "then")
#!/bin/sh
argCount=0
mysql_path=$USER_INSTALL_DIR$
for i in $*; do
/A argCount+=1
done
if ;then
echo... (2 Replies)
I have been using the if statement in csh like this
if ( $opt1 == 1 ) then
.....
elseif ( $opt2 == 1 ) then
......
endif
Seems to work, but got
Badly placed ()'s.
When I used a space in the elseif, a space between the 'else' and the 'if' it worked (0 Replies)