Linked Questions

18
votes
2answers
3k views

Quoting within $(command substitution) in Bash

In my Bash environment I use variables containing spaces, and I use these variables within command substitution. Unfortunately I cannot find the answer on SE. What is the correct way to quote my ...
9
votes
3answers
13k views

Why I can't escape spaces on a bash script?

I'm trying to escape the space char for a path in Bash, but neither using a backslash or quotes works. .sh script: ROOT="/home/hogar/Documents/files/" FILE=${ROOT}"bdd.encrypted" ...
8
votes
3answers
29k views

How can I concatenate a shell variable to other other parameters in my command lines?

How can I concatenate a shell variable to other other parameters in my command lines ? For example, #!/bin/sh WEBSITE="danydiop" /usr/bin/mysqldump --opt -u root --ppassword $WEBSITE > ...
8
votes
7answers
4k views

Splitting large directory tree into specified-size chunks?

I have a directory tree that I would like to back up to optical disks. Unfortunately, it exceeds the size of any one disk (it's about 60GB). I am looking for a script that would split this tree into ...
5
votes
3answers
762 views

What is the difference having double quotes or not in bash [duplicate]

I have some bash scripts, one which has the following content: #!/bin/bash source $(dirname ${BASH_SOURCE[0]})/script.sh while the other one has the following content: #!/bin/bash source ...
5
votes
2answers
341 views

Bash, curious about echo $variable

I was hacking at a small script earlier and noticed something I can't explain. Running this command (time wget --spider http://www.google.co.uk/) 2>&1 | egrep 'real|response' gives me ...
5
votes
3answers
4k views

Why the double quotes and backquotes in a shell script?

I'm looking at this script mysql backup script and I don't understand what is the reason for using both backticks and double quotes around command names? 379 WHICH="`which which`" 380 AWK="`${WHICH} ...
4
votes
2answers
538 views

Shell Script to isolate files scattered in different folders

I need to write a shell script that traverses a given directory structure in multiple levels, recognizes the video files scattered in the folders and copies all of them to another single folder. The ...
3
votes
3answers
693 views

Quote a variable in shell script “if” statement

e.g. if [ "$FOO" = "true" ]; then vs if [ $FOO = "true" ]; then What is the different? Seems both of two statements also works.
3
votes
2answers
253 views

open a file using CDPATH and symlink

To quickly move around, I added a path to CDPATH that contains symlinks to different locations. I did this by adding the following line to .bashrc: export CDPATH=~/symlinks When working with ...
3
votes
2answers
193 views

Bind locally installed library

I have no root-acces on a machine and i'm trying to install a library called GiNaC locally in my home folder. I use this tutorial http://www.ginac.de/tutorial/Configuration.html#Configuration. At the ...
2
votes
2answers
118 views

What is PATH on a Mac OS?

What is the PATH in a Mac OS? I have used it to install global command-line tools, but the only documentation I have found are tutorials for doing just that, with no real explanation of what is ...
1
vote
1answer
168 views

bash script disapearing variable

I have created a small script to move video files from a helmet mounted camera to my mythbuntu machine and there is a variable that for some reason will just not be passed onto the script. The ...
1
vote
2answers
3k views

Creating an empty file having a variable name in a script

I need to create an empty file using a shell script. The filename will be determined by examining all the files in a directory matching a pattern, say TEST.*, and appending _END to it so that the new ...

15 30 50 per page