LinuxQuestions.org
Review your favorite Linux distribution.
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 10-31-2005, 03:30 AM   #1
sridhar11
Member
 
Registered: Dec 2002
Location: us
Posts: 108
Blog Entries: 331

Rep: Reputation: 15
shell script help required syntax error


Hi

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 = $ <'

Script


#!/bin/csh
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
echo "User added. "
exit 0
breaksw

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

case 3:
exit
endsw
continue
end

Thanks for your help

Last edited by sridhar11; 10-31-2005 at 03:58 AM.
 
Old 10-31-2005, 08:38 AM   #2
john2
Member
 
Registered: Aug 2004
Location: UK
Distribution: SolydK, Kubuntu, Mageia, OpenSUSE
Posts: 77

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


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
small shell script required demigor Programming 6 08-08-2005 04:38 PM
shell script provides an error that a binary operator is required max_rsr Linux - General 1 03-12-2005 08: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 01:43 AM
Shell function syntax error... psyklops Programming 1 09-03-2003 01:55 AM
Shell Script Syntax dragon49 Programming 1 03-12-2003 09:25 AM


All times are GMT -5. The time now is 05:12 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration