• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Reply to: Shell Script Help

Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Shell Script Help"

Collapse

  • SimonMac
    replied
    No idea if this is the most elegant way but it seems to work so far

    Code:
    #!/bin/bash
    # Bash Menu Script Example
    
    folder=/home/simonmac
    
    auths=(name1 name2 name3 name4 name5 name6)
    select auth in "${auths[@]}"; do
       cp $folder/auth/$auth/auth.json $folder/AppName/configs/auth.json
       break
    done
    
    configs=(config1 config2 config3)
    select config in "${configs[@]}"; do
        cp $folder/configs/$config/config.json $folder/AppName/configs/config.json
        break
    done
    
    ./AppName/run.sh

    Leave a comment:


  • SimonMac
    replied
    Originally posted by bobspud View Post
    Still need a hand with this? If so PM me.
    Yep, will do!

    Leave a comment:


  • bobspud
    replied
    Originally posted by SimonMac View Post
    If this was windows I could knock this out in seconds, but it's linux and I haven't much experience, or more to the point examples that I reverse engineer and rip off

    I have two variables say "name" and "location"

    What I want to be able to to is create a script that will allow me to pick one from each pre-determined list and then use them in a series of file paths to then move them to a single place

    Code:
    Source\%name%\%1%\filename1
    Source\%name%\%2%\filename2
    Source\%name%\%3%\filename3
    
    Source\%location%\%a%\filename2
    Source\%location%\%b%\filename2
    Source\%location%\%c%\filename2
    
    cp source\%var1%\filename1 destination\filename1
    cp source\%var2%\filename2 destination\filename2
    
    ./destination/run.sh
    Firstly does the ask make sense?
    Still need a hand with this? If so PM me.

    Leave a comment:


  • SimonMac
    started a topic Shell Script Help

    Shell Script Help

    If this was windows I could knock this out in seconds, but it's linux and I haven't much experience, or more to the point examples that I reverse engineer and rip off

    I have two variables say "name" and "location"

    What I want to be able to to is create a script that will allow me to pick one from each pre-determined list and then use them in a series of file paths to then move them to a single place

    Code:
    Source\%name%\%1%\filename1
    Source\%name%\%2%\filename2
    Source\%name%\%3%\filename3
    
    Source\%location%\%a%\filename2
    Source\%location%\%b%\filename2
    Source\%location%\%c%\filename2
    
    cp source\%var1%\filename1 destination\filename1
    cp source\%var2%\filename2 destination\filename2
    
    ./destination/run.sh
    Firstly does the ask make sense?

Working...
X