Here is my script and it does not work

October 18, 2010 at 15:01:06
Specs: Windows 7
I can't figure out what is wrong
if [ "$confirm_reply" = "$noinput" ]
then
echo "No CS4 user name was entered"
else
user_name=$confirm_reply
home_directory="/u/$user_name"
if ["$user_name" = "$( cat /home/reedk/ulist|cut -fl -d':'|grep $user_name)"]
then
echo "CS4 User name already used"
else
echo "Home Directory is: $home_directory"
echo "CS4 User ID is: $user_name"

See More: Here is my script and it does not work

Report •

#1
October 18, 2010 at 19:09:21
= (one equal sign) is for variable assignment
== (two equal signs) is for comparison

Instead of this:

if [ "$confirm_reply" = "$noinput" ]

try this:

if [ "$confirm_reply" == "$noinput" ]

Let me know if this doesn't fix your problem.


Report •

#2
October 19, 2010 at 17:43:09
nails, it doesn't matter whether its "=" or "==".

$ a="a"
$  b="a"
$ [ "$a" = "$b" ]
$ [ "$a" = "$b" ] && echo "same"
same
$ [ "$a" == "$b" ] && echo "same"
same

GNU win32 packages | Gawk


Report •

#3
October 19, 2010 at 17:44:39
@OP, you left out your if/fi block....
if [ ... ]


fi   <----------- left this out.

every "if" you make needs a closing "fi".

GNU win32 packages | Gawk


Report •
Related Solutions


Ask Question