Linked Questions

5
votes
3answers
397 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
311 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" ...
1
vote
1answer
84 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}"
0
votes
1answer
146 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 ...
6
votes
3answers
21k 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 > ...
15
votes
2answers
323 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 ...
8
votes
7answers
3k 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 ...
6
votes
3answers
601 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" ...
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
1k 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
313 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
573 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 # ...
1
vote
1answer
149 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
votes
3answers
1k views

printf white space character in bash script

How can the white space character be escaped in printf for the purpose of this script that currently runs in a Cygwin client? The line containing the whitespace (which by itself works from the command ...

15 30 50 per page