Find the answer to your Linux question:
Results 1 to 4 of 4
Hello everyone, I'm new to programming for Linux and had a few questions: I have a build of Knoppix that automatically runs knoppix.sh at the system start, and was wondering ...
  1. #1
    Just Joined!
    Join Date
    Jun 2011
    Posts
    2

    Case Menus - knoppix & calling on other scripts

    Hello everyone, I'm new to programming for Linux and had a few questions:

    I have a build of Knoppix that automatically runs knoppix.sh at the system start, and was wondering if it is possible to turn the script into a case menu.

    If so, how do I make a case menu option call on another script/program?

    More specifically, the knoppix.sh file runs a few system diagnostic checks (ram, cpu, etc.) and I want to make a menu to either run the checks or do a backup. I know there's a script on here about how to use case to make the backup, but my main concern is to get the case menu to execute multiple scripts, or even call on another menu script.

  2. #2
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Is this knoppix.sh a bash script, I assume? (see top of file)

    So you want to have the script require input from a user to select between two things (checks or backup)? Check out read under the SHELL BUILTIN COMMANDS section in the bash manpage. For case stuff, you can use, yup, case in bash, also in the manpage. There are many examples of case in bash in system initscripts, typically. I'm not sure about Knoppix, but they can usually be found in or near /etc/init.d/.

    hth

  3. #3
    Just Joined!
    Join Date
    Jun 2011
    Posts
    2
    Yeah, the knoppix.sh is a bash script.

    The main problem I've encountered with the knoppix.sh script however, is that when I set it to call another script, it gives me a permission denied error for some reason. I've even quit out of the knoppix script and entered the commands manually and still have no luck. If there's any help for this I'd greatly appreciate it.

  4. #4
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Is the script that you are calling executable? Check the file perms with:
    Code:
    ls -l /path/to/your/script.sh
    Set the script to be executable:
    Code:
    chmod +x /path/to/your/script.sh
    Also make sure that the interpreter at the top your script looks correct, e.g.:
    Code:
    #!/bin/bash
    Note that you should also be able to call a non-executable script like so:
    Code:
    sh /path/to/your/script.sh
    hth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...