LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-06-2012, 07:26 PM   #1
Lindy70
LQ Newbie
 
Registered: May 2012
Posts: 3

Rep: Reputation: Disabled
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.
 
Old 05-06-2012, 07:58 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4885Reputation: 4885Reputation: 4885Reputation: 4885Reputation: 4885Reputation: 4885Reputation: 4885Reputation: 4885Reputation: 4885Reputation: 4885Reputation: 4885
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.

Last edited by TobiSGD; 05-06-2012 at 08:00 PM.
 
Old 05-07-2012, 12:16 PM   #3
Lindy70
LQ Newbie
 
Registered: May 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
After I read your post, my lightbulb went off.
Thanks for taking tie to respond to my post!
 
  


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
problem executing scripts mierdatuti Linux - General 4 09-19-2008 04:21 AM
Executing scripts jonette20 Linux - General 3 10-15-2007 01:50 PM
executing Bash Scripts c4nk Linux - General 3 03-11-2007 04:52 PM
CGI Scripts not executing Mr_Oz Linux - Enterprise 7 04-18-2006 03:21 PM
Executing shell scripts justinv Linux - General 6 01-26-2003 07:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:58 AM.

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