Sponsored Content
Full Discussion: Use of cp in a script
Top Forums Shell Programming and Scripting Use of cp in a script Post 302581965 by ifthanwhile on Wednesday 14th of December 2011 02:13:16 PM
Old 12-14-2011
Use of cp in a script

I am trying to copy files and directories from on flash drive to 5 others, the copy works fine with cp -R but when used in the script it only copies to one of the drives and then finishes the rest of the script without a problem.

Code:
#!/bin/sh
#Script to copy files to flash drives
#
quit=n
while test "$quit" = "n"
 do
  echo "Press enter once all drives are inserted..."
  read junk
  cp -R /Volumes/[MasterDrive]/ /Volumes/NO\ NAME/   #NO NAME is default
  cp -R /Volumes/[MasterDrive]/ /Volumes/NO\ NAME1/
  cp -R /Volumes/[MasterDrive]/ /Volumes/NO\ NAME2/
  cp -R /Volumes/[MasterDrive]/ /Volumes/NO\ NAME3/
  cp -R /Volumes/[MasterDrive]/ /Volumes/NO\ NAME4/
  clear
  echo "Copy Completed"
  diskutil rename /Volumes/NO\ NAME [SameNameAsMaster]
  diskutil rename /Volumes/NO\ NAME\ 1 [SameNameAsMaster]
  diskutil rename /Volumes/NO\ NAME\ 2 [SameNameAsMaster]
  diskutil rename /Volumes/NO\ NAME\ 3 [SameNameAsMaster]
  diskutil rename /Volumes/NO\ NAME\ 4 [SameNameAsMaster]
  echo
  echo
  echo
  echo "Data has been copied and drives have been renamed"
  echo "Press "C" and then enter to continue, or press q to quit"
  read choice
  case $choice in
   q) quit=y;;
   c) clear;;
  esac
 done
exit 1

I know my style is not that great and that I could streamline this in any number of ways Smilie but this is what I know and can write in 15-20 minutes, anything else is probably too complicated for my feeble mind.

Any help would be greatly appreciated...
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

2. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

4. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

5. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
curs_beep(3CURSES)					     Curses Library Functions						curs_beep(3CURSES)

NAME
curs_beep, beep, flash - curses bell and screen flash routines SYNOPSIS
cc [ flag ... ] file ... -lcurses [ library ... ] #include <curses.h> int beep(void); int flash(void); DESCRIPTION
The beep() and flash() routines are used to signal the terminal user. The routine beep() sounds the audible alarm on the terminal, if pos- sible; if that is not possible, it flashes the screen (visible bell), if that is possible. The routine flash() flashes the screen, and if that is not possible, sounds the audible signal. If neither signal is possible, nothing happens. Nearly all terminals have an audible sig- nal (bell or beep), but only some can flash the screen. RETURN VALUES
These routines always return OK. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
curses(3CURSES), attributes(5) NOTES
The header <curses.h> automatically includes the headers <stdio.h> and <unctrl.h>. SunOS 5.11 31 Dec 1996 curs_beep(3CURSES)
All times are GMT -4. The time now is 09:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy