Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 10-31-2005, 04:30 AM   #1
Registered: Dec 2002
Location: us
Posts: 108
Blog Entries: 360

Rep: Reputation: 15
shell script help required syntax error


I am writing a script to adduser,group and create a folder called public_html with the permissions required and i am deleting the user.For this i am trying write a script with options selection for adding user,deleting user and exit.The script as follows.when i try to run these two scripts it is working fine.I am trying this script in debian.When i combine with the menu script i am getting syntax error

complete.csh: line 2: echo===============================================================: command not found

Welcome to User Management \!\!

complete.csh: line 6: echo===============================================================: command not found

complete.csh: line 20: syntax error near unexpected token `newline'
complete.csh: line 20: `set num = $ <'


echo "==============================================================="
echo ""
echo " Welcome to User Management \!\! "
echo ""
echo "==============================================================="
echo ""

while (1)

echo ""
echo ""
echo "Please select an option from the following menu."
echo ""
echo "1. Add New Account"
echo "2. Remove existing account"
echo "3. Exit Menu"
echo ""
echo -n "Enter selection >> "
set num = $<
echo ""
echo ""

switch ($num)

case 1:
echo "User to add:"; read UAuser;
groupadd $UAuser
useradd -g $UAuser -m -d /home/www/$UAuser -s /bin/sh $UAuser
mkdir /home/www/$UAuser/public_html
chown $UAuser /home/www/$UAuser -R
chgrp $UAuser /home/www/$UAuser -R
chmod 711 /home/www/$UAuser -R
chmod 755 /home/www/$UAuser/public_html/ -R
passwd $UAuser
echo "User added. "
exit 0

case 2:
echo "Enter the UserName:"; read UAuser
userdel -r $UAuser
groupdel -r $UAuser
echo "User deleted Successfully"
exit 0

case 3:

Thanks for your help

Last edited by sridhar11; 10-31-2005 at 04:58 AM.
Old 10-31-2005, 09:38 AM   #2
Registered: Aug 2004
Location: Wales
Distribution: Mint, Mageia, OpenSUSE, Kubuntu
Posts: 95

Rep: Reputation: 25
Looks as if it isn't recognising line throws. Has either script ever been on a Windows machine?


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
small shell script required demigor Programming 6 08-08-2005 05:38 PM
shell script provides an error that a binary operator is required max_rsr Linux - General 1 03-12-2005 09:26 AM
got a syntax error which shows unexpected end of line when tried to run a shell scrip racer_mec Linux - Newbie 1 01-10-2005 02:43 AM
Shell function syntax error... psyklops Programming 1 09-03-2003 02:55 AM
Shell Script Syntax dragon49 Programming 1 03-12-2003 10:25 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:07 PM.

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