LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-22-2003, 12:15 AM   #1
evilchild
Member
 
Registered: Sep 2003
Location: 127.0.0.1
Distribution: *bsd, solaris, gentoo
Posts: 86

Rep: Reputation: 15
Question help on web folder script


I writing a script that creates a webfolder , set permissons, ownership and copies a sample index, for user that are requesting web space on my server. For some reason the if statment in my script doesnt seem to work properly, here 's what i got
#!/bin/bash
# webspace creater tool built by seejay@n3tlab

me=$(whoami)
choice=" "
clear
#intro for user
echo With your existing shell account you can create a web page you can access threw your account, but you must know html in order to use this feature, are you sure you want to create a web account ? yes or no
read choice

# if user says yes there dir is created in the web folder
if [$choice="yes"]
then
mkdir /var/www/html/freespace/$me/
echo your web folder is /var/www/html/freespace/$me/ and can be viewed at http://n3tlab.hopto.org/freespace/$me/
# set permissions and ownership
chown $me /var/www/html/freespace/$me
chmod 755 /var/www/html/freespace/$me
# copy sample index to web folder
cp /usr/bin/index.html /var/www/html/freespace/$me
exit

#if user says no or anything else
else
echo your web folder will not be created, thanks for using n3tlab
exit
fi

# all done

The script will run but no matter what the user inputs the script outputs a error "

/usr/bin/webhosting: line 12: [yes=yes]: command not found
your web folder will not be created, thanks for using n3tlab
[seejay@localhost seejay]$ "

i think that it's not reconizing the if statment properly, can some one please help me?
 
Old 11-22-2003, 07:40 AM   #2
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
Your line 12:
Code:
if [$choice="yes"]
should be
Code:
if [ $choice = "yes" ]
Note the spaces!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help, Adding New HD to Web Server HTML folder jtyler Linux - General 1 10-27-2005 09:59 AM
Directory index of web folder Swakoo Linux - Newbie 3 06-17-2005 04:28 AM
How can you get a list (names) of pictures from a web folder? Laser Devil Programming 5 06-11-2005 12:51 AM
WHere is my web folder on suse 9.0 Virtualhate Linux - Newbie 2 06-08-2004 12:28 AM
mount web folder? keithturner Linux - Newbie 8 01-24-2003 07:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration