The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Scripting problem - when the file is not found i want it to return to the menu Alendrin Shell Programming and Scripting 2 03-04-2009 01:25 PM
Using a list menu as a variable Great Uncle Kip UNIX for Dummies Questions & Answers 3 01-22-2009 11:41 AM
Help with find command and list in a long format each found file alexcol Shell Programming and Scripting 5 12-10-2007 08:59 AM
Ambiguous and Command not found Error in UNIX koti_rama Shell Programming and Scripting 2 07-13-2007 10:42 AM
Ambiguous and Command not found Error in UNIX koti_rama UNIX for Dummies Questions & Answers 2 07-12-2007 09:44 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-17-2009
morava morava is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 5
Menu list in Unix csh - command not found

Hello, im taking a class of Unix and i dont really know much about it, im trying to create a list of menu a user would select from and im very lost. Basically it will have 5 options, the user will chose from:
1. list files in the pwd
2. display date and time
3. is the file file or directory
4. create a backup
5. exit

I have no idea how to do options 3 and 4, i think i did right options 1.2.5. When I try to run the file (it has the x permission now) i am getting a command not found. Any idea how to finish it? Thanks !!

This is what i have right now:


#!bin/csh
# This menu will allow user to select from a menu of options, and then perform the
# selected command. User can use options until he chooses to exit
while :
do
clear
echo ***** Select from menu *****
echo "[1] List all files in the current directory"
echo "[2] Display today's date and time"
echo "[3] Display whether a file is just a file, or if it is a directory"
echo "[4] Create a back up file"
echo "[5] Exit the menu"
echo -n "Select your choice {1-5}:"
read yourch
case $yourch in
1) echo "These are your files: "; ls -l; echo "Press Enter"; read;;
2) echo "Today is 'date', time is 'time'; echo "Press Enter"; read;;
5) exit 0 ;;
"menunix" 21 lines, 652 characters
  #2 (permalink)  
Old 03-17-2009
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,400
Quote:
Originally Posted by morava View Post
Hello, im taking a class of Unix and i dont really know much about it, im trying to create a list of menu a user would select from and im very lost. Basically it will have 5 options, the user will chose from:
1. list files in the pwd
2. display date and time
3. is the file file or directory
4. create a backup
5. exit

I have no idea how to do options 3 and 4, i think i did right options 1.2.5. When I try to run the file (it has the x permission now) i am getting a command not found. Any idea how to finish it? Thanks !!

This is what i have right now:


#!bin/csh
# This menu will allow user to select from a menu of options, and then perform the
# selected command. User can use options until he chooses to exit
while :
do
clear
echo ***** Select from menu *****
echo "[1] List all files in the current directory"
echo "[2] Display today's date and time"
echo "[3] Display whether a file is just a file, or if it is a directory"
echo "[4] Create a back up file"
echo "[5] Exit the menu"
echo -n "Select your choice {1-5}:"
read yourch
case $yourch in
1) echo "These are your files: "; ls -l; echo "Press Enter"; read;;
2) echo "Today is 'date', time is 'time'; echo "Press Enter"; read;;
5) exit 0 ;;
"menunix" 21 lines, 652 characters
try reading man page of test command for your 3rd option
you can use cp or mv to create backup of file
  #3 (permalink)  
Old 03-18-2009
morava morava is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 5
Thanks ! I tried to something but it's still not working, still getting Command not found error:


#!bin/csh
# This menu will allow user to select from a menu of options, and then perform the
# selected command. User can use options until he chooses to exit

while :
do
clear
echo ***** Select from menu *****
echo "[1] List all files in the current directory"
echo "[2] Display today's date and time"
echo "[3] Display whether a file is just a file, or if it is a directory"
echo "[4] Create a back up file"
echo "[5] Exit the menu"
echo -n "Select your choice {1-5}:"
read yourch
case $yourch in
1) echo "These are your files: "; ls -l; echo "Press Enter"; read;;
2) echo "Today is 'date', time is 'time'; echo "Press Enter"; read;;
3) echo "Is the file a file or a directory?"; -a $1; echo "File is a file, not a directory"; read;;
4) echo "Create a backfile"; mv $; echo "Press Enter"; read;;
5) exit 0 ;;
  #4 (permalink)  
Old 03-18-2009
Goldorakk's Avatar
Goldorakk Goldorakk is offline
Registered User
  
 

Join Date: Feb 2009
Location: France
Posts: 43
#!bin/csh -> #!/bin/csh ???

After, I don't like csh so ...
  #5 (permalink)  
Old 03-18-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,183
The script looks more like ksh than csh. There is very little demand for "csh" nowadays.

The "case" should be terminated with an "esac".
  #6 (permalink)  
Old 03-18-2009
Goldorakk's Avatar
Goldorakk Goldorakk is offline
Registered User
  
 

Join Date: Feb 2009
Location: France
Posts: 43
The "command not found" is a problem with bin/csh vs /bin/csh ...
This is the subject, so I just answered on the subject ...
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0