Newbie CentOS Scripting Question..
Hi everyone,
Long time forum lurker..first time user here. I am a COMPLETE newbie to all things Unix/Linux and I was hoping for a little advice (or appropriate direction) on a scripting problem I have been set. I was been asked (college lecturer) to write a script which will display the user options that which will allow a user to: 1. create a file 2. delete a file 3. change permissions 4. rename a file 5. copy a file 6. exit I started by creating the script, and echoing the options to screen..but from there I am completely lost! I have previously used the Case & If selection structures but only to echo input back to screen, but that is about as far as I have gone. Any advice would be gratefully appreciated! |
I'm assuming you're writing a Bash script. This is a good reference for Bash scripting. Look in the section on command substitution since you're just writing a script that wraps shell commands. For example, with the first option you could use the shell command touch to create the file.
|
1 Attachment(s)
Quote:
Code:
menu () { Code:
op1 () { Code:
if [[ menunum = 1 ]] ; then NOTE: I didn't debug this, if you want to use it, you debug it. You're the one that will be writing it. ;) |
Quote:
Wow, thank you VERY much!! I didn't expect that level of help..but REALLY appreciated!! :D |
Did it work?
Fred. |
Quote:
Playing around with it, but not luck fixing it yet..any suggestions if someone sees something I don't would be appreciated! :) |
Quote:
|
Quote:
Nearly there..sorted out the 'fi' bug, a couple more to finish off..hopefully!! Great learning process!! :) |
Adding
Code:
set -xv |
All times are GMT -5. The time now is 03:59 AM. |