Linked Questions

5
votes
3answers
495 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 ...
1
vote
1answer
367 views

What is the difference between $var and “$var”? [duplicate]

Possible Duplicate: $VAR vs ${VAR} and to quote or not to quote I assigned a variable var a value as follows: pradeep@pradeep-laptop:~$ var="Pradeep > is > a good > boy" ...
0
votes
1answer
287 views

when to use double quotes with a variable in shell script? [duplicate]

I am in a confusion with what is meant by the double quotes referring to a variable. For example following two scripts gives the same output. What is really meant by the double quotes? Script1 ...
1
vote
1answer
89 views

what is diffrence between “$var” and “${var}” [duplicate]

i have seen in many script usage of "$var" and "${var}", so I just want to know diffrence between "$var" and "${var}"
8
votes
3answers
24k 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 > ...
16
votes
2answers
677 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 ...
6
votes
3answers
3k 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
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 ...
4
votes
3answers
3k 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} ...
1
vote
2answers
2k 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 ...
5
votes
2answers
327 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 ...
0
votes
2answers
759 views

$(tail) into variable removing \n

I am doing the following: x="Hello to the world of tomorrow\n <pre>"; x="${x}$(tail -n 50 log/logfile.log)" x="${x}</pre>"; echo -e $x | ./perlscript The Perl script: #!perl # ...
3
votes
3answers
467 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.
1
vote
1answer
158 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 ...

15 30 50 per page