Noob. shell script with prompt?

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Noob. shell script with prompt?
# 1  
Old 09-21-2016
Noob. shell script with prompt?

Hey Guys and Gals, Im a complete Noob to Unix. But recently have started working on a unix system for my PET/CT scanner. My scanner comes with a MOD drive for backup. I would like to back up to USB (its alot cheaper). But the only way to do so is by manually enterin the unix commands. Id like to write a shell script to back up the files. I have tried to get one going with a prompt, but i keep getting errors. Think you guys can help me out? here are oics of what i have written and pics of the code from the manufacturer.
Noob. shell script with prompt?-20160921_103742jpg
Noob. shell script with prompt?-20160921_120726jpg
# 2  
Old 09-21-2016
Getting what errors?

If you can copy/paste text instead of posting screenshots that would be better.

The code you show is missing a fi. if/else statements in bash work like:

Code:
if [ statement ]
then
        something
else
        something
fi

# 3  
Old 09-21-2016
ah ok. damn i feel dumb. does the rest of the code look ok so far? I cant copy and paste. That system doesnt have internet access. plus the other code is written in the manual. do i just enter the rest of the code underneath the mkdir line?

---------- Post updated at 01:35 PM ---------- Previous update was at 01:20 PM ----------

so, added in the fi, then when i run the script im getting !/bin/bash not found, my echo commands and then -r: is not an identifier.
# 4  
Old 09-21-2016
It should be #!/bin/bash, not !#/bin/bash.
# 5  
Old 09-21-2016
Ok, out of the office for the day, will check it tomorrow.
# 6  
Old 09-21-2016
An embedded device might not actually have /bin/bash, only a more basic /bin/sh.
# 7  
Old 09-21-2016
Quote:
Originally Posted by Corona688
An embedded device might not actually have /bin/bash, only a more basic /bin/sh.
But you can try "which bash" or "which ksh" or "which sh"
bash would be best if you have it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script prompt for first parameter ($1) then run

I have to run post configuration script like this script file is post_config.sh post_config.sh 1234 #1234 is node ID according to given node ID all script run .. .. But i want to post_config.sh script should ask for node ID then run like this.. post_config.sh #i want to run... (8 Replies)
Discussion started by: Ganesh Mankar
8 Replies

2. Homework & Coursework Questions

Shell Script Password Prompt

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to write a shell script that prompts the user for the password which is "lux" once the correct password... (4 Replies)
Discussion started by: Emin_Em
4 Replies

3. Shell Programming and Scripting

unable to pass value to user prompt from calling shell script

This is my script structure main script calls configure script which needs to be run as a different user and the configure script calls my application installation script. the application instruction script prompts the user for a directory which I need to pass from my main or configure script. ... (4 Replies)
Discussion started by: cmastays
4 Replies

4. Homework & Coursework Questions

Unix Shell Script to prompt customer for name etc

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: How do I create a shell script called 'custinfo' to prompt a customer to enter and display back the following:... (4 Replies)
Discussion started by: SQLScript
4 Replies

5. UNIX for Dummies Questions & Answers

Shell Script to prompt customer for name etc

reposting How do I create a shell script called 'custinfo' to prompt a customer to enter and display back the following: name, age, address, phone number, product, price range. Thanks (1 Reply)
Discussion started by: SQLScript
1 Replies

6. Shell Programming and Scripting

Shell Script to prompt customer for name etc

How do I create a shell script called 'custinfo' to prompt a customer to enter and display back the following: name, age, address, phone number, product, price range. Thanks (1 Reply)
Discussion started by: SQLScript
1 Replies

7. Shell Programming and Scripting

shell script executes program, but waits for a prompt

Sorry, newbie here. I have the following shell script which basically executes the sh-n-body.i686 program a specified number of times. However, before the sh-n-body.i686 begins its calculations it prompts for input from the user. In this case the user would have press ". return" and... (7 Replies)
Discussion started by: lionatucla
7 Replies

8. Shell Programming and Scripting

Can give the input to prompt using shell script

Hi, I want to send input to promt from shell script, this thing is possible. I give the one command `/usr/share/ssl/misc/CA -newreq` it needs some user input like password etc., but i need this input also from shell script but it does not works. `/usr/share/ssl/misc/CA -newreq` <<EOF... (2 Replies)
Discussion started by: Vaibhav Agarwal
2 Replies

9. UNIX for Dummies Questions & Answers

sudo in OS X shell script without password prompt??

I've written a shell script to alter a particular preference file on OS X (10.3.9), which works fine (tested by running the script from the terminal sat in front of the box). Problem is, I now have to run this script remotely across a number of machines via remote desktop, so where I've used the... (1 Reply)
Discussion started by: Brad_GNET
1 Replies

10. Shell Programming and Scripting

script to change shell and prompt

I want to write a shell script which will change the current shell (say from csh to bsh) and my Prompt (say my name) as desired.pls help (1 Reply)
Discussion started by: SHYAM
1 Replies
Login or Register to Ask a Question