Linked Questions

86 votes
3 answers
283k views

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" DESTINATION="/home/...
Lucio's user avatar
  • 1,317
40 votes
4 answers
230k views

I assigned a var like this: MYCUSTOMTAB=' ' But using it in echo both: echo $MYCUSTOMTAB"blah blah" or echo -e $MYCUSTOMTAB"blah blah" just returns a single space and the rest of the string: ...
user3450548's user avatar
  • 3,104
53 votes
2 answers
206k views

I'm trying to pass multiple argument to a function, but one of them is consist of two words and I want shell function to deal with it as one arg: args=("$@") function(){ echo ${args[0]} echo ${args[...
user78050's user avatar
  • 1,115
21 votes
1 answer
39k views

I have a bash script. If I run this command to: grep for certain patterns, transform the output, sort the output dedupe the output then I get one grep find per line in terminal LC_ALL=C grep -o --...
bernie2436's user avatar
  • 6,855
21 votes
1 answer
40k views

I have a path "/third/party/city of las vegas" when cd the path I use "/third/party/city of las vegas". In .profile file I have exported the path to a variable as follows export clv="/third/party/...
Aravind's user avatar
  • 1,679
9 votes
2 answers
21k views

I'd like to build an error handler which will make an empty file marked with the error_occur time. The core idea is to use the result of date command as a parameter. I did: time_stamp=$(date) touch ...
ZengJuchen's user avatar
  • 7,927
3 votes
3 answers
6k views

Here is an example of file path: /isf/GCM/VPfig/Aas/AR/ClCo el Doma Republic/VMN CRTro.txt What I want to get is the file basename: VMN CRTro.txt So I try the following: echo /isf/GCM/VPfig/Aas/AR/...
maihabunash's user avatar
  • 7,231
10 votes
2 answers
2k views

$ a='"apple","ball","cat"' $ a='['$a $ echo $a ["apple","ball","cat" $ a=$a']' $ echo $a b I'm stumped hard by the result b while I expect to see ["apple,"ball","cat"]. What am I missing here? This ...
user3866672's user avatar
9 votes
3 answers
4k views

I have file called -l in my directory now I tried to do for i in *; do stat -c "%s %n" "$i"; done it lists all files with sizes but in the middle of the output there is something like 395 koko.pub ...
lllook's user avatar
  • 420
7 votes
2 answers
113k views

I'm trying to create a directory which has space in name e.g. "user test" when I fire mkdir -p "user test" it works for me. When I put "user test" in variable mkdir fails, it creates "user and test" ...
chhaya vishwakarma's user avatar
1 vote
2 answers
55k views

I am trying to copy some files with spaces and $, @ symbols in their file names in a bash script but the script fails to copy the files stating it cannot find the file. I can see that it is treating ...
Ankit Vashistha's user avatar
9 votes
1 answer
6k views

In Bash, when I do: foo="*" echo $foo It expands * to the contents of the current folder. How do I make sure it just prints a literal *? The same, by the way, happens with a regular echo "$foo", it ...
Amelio Vazquez-Reina's user avatar
4 votes
2 answers
24k views

SED command not replacing in bash under Debian, but works in command line. Works in command line: sed -i 's|/dev/disk/by-label/SR6D4|/dev/disk/by-label/SR4D4|g' /etc/my/config.xml Not working in ...
klor's user avatar
  • 436
6 votes
1 answer
10k views

How can I give space " " as input in shell script ? Ex : echo " Enter date for grep... Ex: Oct 6 [***Double space is important for single date***] (or) Oct 12 " read mdate echo $mdate I get the ...
Kumar's user avatar
  • 933
3 votes
1 answer
20k views

I have a script that will try to extract the file's base name and then I do additional work with it. Only when using this script with a file with this naming convention (including spaces and ...
ksa_coder's user avatar
  • 153

15 30 50 per page
1
2 3 4 5
54