Problems executing scripts
I'm a complete novice and I'm trying to write a script that will upon selection either:
1. Show the current directory 2. Delete a file 3. Rename a file This is what I've tried, with no success: Using vi I created filepro #!/bin/ksh cat <<++ MAIN MENU 1) Print current working directory 2) Delete file in current directory 3) Rename file in current directory ++ echo Please enter your selection $LOGNAME: Chmod 755 filepro ./filepro Everything appears fine: MAIN MENU 1) Print current working directory 2) Delete file in current directory 3) Rename file in current directory Please enter your selection LNOWE: Until I enter my selection, when selecting 1 I should get the directory instead I get: 1: not found I’ve tried adding and removing spaces in the main menu. I tried #!bin/bash, #!bin/sh. Adding and removing space between cat <<++. This is obviously a simple straight forward script. But I can’t seem to get it right. Please help. Thanks! Sorry if this is not formated properly, haven't figured out the forum posting yet. |
Your script does nothing more than printing a few lines and going back to the shell. You have no command to read input, no structure to parse the input and no actions being done after parsing the input.
I recommend to start here first: http://linuxcommand.org/index.php http://tldp.org/LDP/abs/html/ To post code on this forum with formatting press the #-button above the text input field, this will bring up [code][/code] tags. Put your code between them. |
After I read your post, my lightbulb went off.
Thanks for taking tie to respond to my post! |
All times are GMT -5. The time now is 06:49 PM. |