Linked Questions

1 vote
1 answer
29k views

I'm getting started with bash scripting. I'm working with array elements that contain space characters. In the code below, the third array element is "Accessory Engine". I tried to set the space ...
seb's user avatar
  • 133
4 votes
2 answers
5k views

I have folder named play which contains a file damn file (with space). When I use find and pipe the output to tar: find play/ -name 'damn*' | tar cf archive.tar -T - It works perfectly. Why does this ...
Majid Azimi's user avatar
  • 3,198
3 votes
1 answer
4k views

Is this a Bash bug? $ mkdir test && cd test && echo "a" > "some.file" test$ echo '*' * test$ TEST=$(echo '*') test$ echo $TEST some.file Why is the second output the resolution of *...
Roel Van de Paar's user avatar
2 votes
2 answers
10k views

I would like to escape path with white space which works fine when I use it directly like this: $ printf '%q' "/path/to/first dir/dir/" /path/to/first\ dir/dir/ When I use a variable instead of ...
monkeywrench's user avatar
5 votes
1 answer
8k views

I need to store specific number of spaces in a variable. I have tried this: i=0 result="" space() { n=$1 i=0 while [[ "$i" != $n ]] do result="$result " ((i+=1)) ...
kpmDev's user avatar
  • 189
1 vote
1 answer
7k views

I am trying to read in a file using read in bash 3.2, but read seems to be converting any instance of multiple whitespace into a single space. For example, the code below has two tabs between "hello" ...
Josh Sherick's user avatar
0 votes
1 answer
17k views

I have the following function inside a BASH script (running under Ubuntu 12.x), which would copy over a file with spaces inside the file name. It's not working. I've tried many different combinations, ...
Chris Galas's user avatar
3 votes
3 answers
3k views

When I execute the following command: #!/bin/bash while IFS= read -r -d '' file; do files+=$file done < <(find -type f -name '*.c' -print0) echo "${files[@]}" I do not get the same result ...
antinomy's user avatar
2 votes
2 answers
790 views

I cannot set a variable with a whole command-string as following: A="/bin/ps wwwaux" for a in $A do echo "$a" done It assigns array instead of solid string someway. My environment: GNU/Linux, ...
Denis Kulagin's user avatar
1 vote
2 answers
12k views

Say I have a script that has: command $1 Also say command has an optional parameter so it could also be command $1 $2. What happens if $1 includes a space here (let us assume $1=A B)? Will command ...
Philip Kirkbride's user avatar
0 votes
1 answer
10k views

I need to write a script to test if a service inside of an Android emulator is ready for apk installation or not using this command adb -s emulator-5554 shell pm list package | grep package:com....
the_prole's user avatar
  • 457
1 vote
2 answers
2k views

I want to rename a file dynamically based on data which contains spaces Name="Abc DEF" Name1="GHI JKL" mv /sample/pdf/noriginalName.pdf /sample/outputPdf/${NAME}${Name1}".pdf" But it gives me an ...
Rahul's user avatar
  • 11
1 vote
1 answer
10k views

I have script to run a jar, like shown below. user="Tim Tom"; jarfile=./app.jar SC_CD="java -jar -Xms512m -Xmx2048m -DUSER='$user' $jarfile" nohup $SC_CD And im geeting error message as Error: ...
anij's user avatar
  • 113
2 votes
2 answers
2k views

I have the following example: $ a="$(ls)" $ echo $a backups cache crash lib local lock log mail opt run snap spool tmp $ $ echo "$a" backups cache crash lib local lock log mail ...
t7e's user avatar
  • 323
2 votes
2 answers
3k views

Although I've read myself through most of the questions about handling spaces in path names, I haven't found my case yet, which is about several path names in one variable. find will need this when ...
syntaxerror's user avatar
  • 2,426

15 30 50 per page
1
2
3 4 5
54