Register
It is currently Mon Apr 23, 2018 6:39 pm

Simple bash, I think :)


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue Sep 19, 2017 11:35 am   

Joined: Tue Sep 19, 2017 11:15 am
Posts: 1
Hello,

I don't know anything about linux but to use a software with gpt, uefi, I must use a udf that boot with linux. I'm hoping somebody will be kind enough to help me :) I few years ago I was using a dos version and made a simple batch file......

@echo off
echo 1- Save A
echo 2- Save B
echo 3- Restore A
echo 4- Restore B
choice /c:1234 /n
if errorlevel == 4 goto 4
if errorlevel == 3 goto 3
if errorlevel == 2 goto 2
if errorlevel == 1 goto 1
:1
c:\image /b /d:[email protected] /f:[email protected]:\images\backupA /rb:1
:2
c:\image.......etc
:3
c:\image...etc
:4
c:\image....etc

So at boot I had 4 options, starting 4 different backups. With the linux version I made a similar batch, (bash) for one option but I have no idea on how to make one with OPTIONS to start different lines. The bash I have is...

#!/bin/bash
imagel --b --d:l0 --f:[email protected]:/images/ori/imacomp2 --uy --comp:0 --rb:8

Thank you very much

Dany


Top
 Profile  
 PostPosted: Tue Sep 19, 2017 10:10 pm   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 574
Code:
echo type q to quit
while read -p "Choose a job " answer; do
    case $answer in
        1|2     )    echo answer was 1 or 2
                     echo but i do not like the answer.
                     ;;
        a|b     )    echo answer was a or b
                     echo somewhat better answer
                     ;;
        h*|j*   )   echo answer started with h or j
                    echo finally you got it.
                    break
                    ;;
        q       )   echo thanks for using stupid scripts;  break;;
        *       )   echo ERROR. Answer not valid;;
    esac
echo type q to quit
done
read help case and help read
If numeric answers are enough you can use the old command select
Read help select
break leaves the construct and continues the script. Read help break
exit leaves the script entirly. Read help exit


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP