Problem setting path to external hard drive as a variable
Hello all,
I am EXTREMELY new to using bash and I have a bit of a problem: I'm trying to set up a shell script that can
1.) take one of several giant files off of an external hard drive
2.) use it as input for scripts on my laptop's hard drive
3.) send output of those scripts to the external hard drive
4.) delete the giant file off my laptops hard drive
5.) repeat
Everything is set up in a cript i wrote that performs this process using three different folders on my laptop, but when i go to pull files off my external hard drive I find I am unable to do so! I've poked around and tried to find the problem, but as a true novice I'm having no luck. Heres what it looks like:
Gives me the output:
Any suggestions?
Last edited by machine_spirit; 02-16-2019 at 01:17 AM..
Reason: Found a typo
This User Gave Thanks to machine_spirit For This Post:
Hi
remove the space after the equal sign
Enclose the variable in double quotes. --- Post updated at 05:49 ---
instead of this command. so do not override variables
use this expression. --- Post updated at 06:20 ---
It's all unnecessary --- Post updated at 06:31 ---
If this experiment then is better so --- Post updated at 06:40 ---
I tried to delete a character \r so echo ${var%\r} and so echo ${var%[\r]} Did not work out.
This expression is not correct since any last character will be deleted. echo ${var%?}
The only way echo ${var%[[:cntrl:]]}
With bash, you have the "special treatment" of $'\xxx' strings during "parameter expansion". So nezabudka's proposal could be written like
But I'm not sure that would remove your error message. Sure that directory exists? Doesn't have non-printing characters in its name? Is the external drive correctly mounted, and where?
I plugged in your first suggestion and it seems to work just fine! I think I will use that code for now, though I will study your's and other commenters' more compact, elegant solutions later when I have more time: I'm such a neophyte I actually find that the least elegant, most sprawling code is often the easiest for me to understand. Its like learning how clocks work from disassembling one: you want to start with a cheap, simple bedside alarm clock, not a finely crafted rolex!
My code is this, what I'm trying to accomplish is to make a list of all pdf documents in my computer and then copy all of those documents to my external hard drive in a directory
mkdir /Volumes/Hardrive-1/allpdf
echo "File Locations" > /Volumes/Hardrive-1/allpdf/FileLocations.txt
mdfind pdf... (2 Replies)
Hi Guys..
I want to install Linux on my portable hard drive.
I created a 20GB partition in my hard drive for linux, Now I want to make it bootable mean when I connect it to system n start the system it will start the LINUX and when start without usb-hard drive it should start the windows.
... (3 Replies)
Hi Folks,
First a little background, I am working on a ship that operates in the Indian Ocean and Persian/Arabian gulf area. We had a Sunblade 2000 that finally died. The Video board burned up and I guess damaged the mother board. So we ordered 2 rebuilt 2000s one as a spare. Due to mounting... (1 Reply)
Guys,
I have googled and checked this forum in detail and couldn't find any satisfactory answers for my problem.
I am trying to connect a external SCSI hard Drive(Sea Gate) to a Ultra 80.
I connected it powered it up and at OK prompt did : boot -r
system comes up and complains about not... (6 Replies)
Can anyone please walk me through how to mount an external parallel (or scsi) hard drive in visualize C3000 machine? I also would like to mount "/var/sallie" directory in that external drive. My "/var/sallie" directory is running out of space so I would like to mount an external hard drive so that... (0 Replies)
i have a Simple Tech hard drive that i use between two computers. it is formatted to ntfs. i have a dell desktop with Ubuntu 7.10 and Ubuntu 8.04 and Windows XP Home. and i have a laptop with Ubuntu 7.10 and Ubuntu 8.04. the laptop recognizes the hard drive on both 8.04 and 7.10 but my desktop... (9 Replies)