Skip to main content

All Questions

0 votes
1 answer
57 views

value of $VAR already contains backtick and/or single quote inside. How to handle it? How to properly pass $VAR to program? [duplicate]

$ bash --version GNU bash, versione 5.2.26(1)-release (x86_64-pc-linux-gnu) I don't know how to deal with $VAR when its value inside contains single quote (') and/or backtick (`). I'm in the need of ...
dAllARA's user avatar
  • 33
8 votes
1 answer
5k views

What are curly quotes and can I use them in my code?

Somehow curly quotes got into my code and I'm getting unexpected behavior #!/bin/sh if [ foo = ‘foo’ ]; then echo yes else echo no fi I would expect this to echo yes but instead it echoes no.
jesse_b's user avatar
  • 37.5k
0 votes
3 answers
2k views

"bash: !/bin/su": event not found" [duplicate]

I have line in script which is working, but not working from command line. echo "User ALL = NOPASSWD: ALL, !/bin/su" | sudo tee -a /etc/sudoers [user@localhost ~]$ echo "test ALL = NOPASSWD: ALL, !/...
Panda's user avatar
  • 111
7 votes
3 answers
35k views

How to add a line break inside a bash string? [duplicate]

I have the following bash string and I need to add a line break to it, before the 'Hello' string: bash -c "echo 'Hello' > /location/file" I already tried adding it with different variations of ...
user avatar
1 vote
1 answer
202 views

Tab character in exiftool

I need to insert tab character on place of _ between day and hour. exiftool -T -r -filename -CreateDate -d "%Y%"."%m%"."%d_%H%"."%M%"."%S" /Users/***/***/testmapa/mapa2/ > /Users/***/***/testmapa/...
ikiK's user avatar
  • 131
1 vote
3 answers
205 views

how to filter inner quotes? [closed]

is it possible to filter, i.e to put ESC in front of the inner quotes with sed, awk or other *NIX tool (no perl/python)? Example (revised): $ echo label=\"123 \"456\" 789\" \"AB C\" e f gh | magic-...
ivand58's user avatar
  • 125
2 votes
2 answers
1k views

Problem with spaces when used in find command

I'm trying to place a zip file with the content of the directory in each directory that doesn't contain any subdirectory. The following command works if there's no space in dirnames and/or filenames ...
dargaud's user avatar
  • 565
18 votes
2 answers
106k views

How to use a special character as a normal one in Unix shells?

Many questions like 'How to type the double-quote char (")?' are being asked, and we don't want to clutter our community with the same answer (Type it as \" if not enclosed in 's, " if enclosed in 's.)...
EKons's user avatar
  • 954
1 vote
2 answers
2k views

Shell eating `?` characters

This is such a simple question that I'm sure it's been asked somewhere, but I can't find it. My shell, which I have not intentionally set up to do so, seems to eat any words involving question marks: ...
LSpice's user avatar
  • 113
0 votes
2 answers
3k views

Define string with the characters *, single quote and $

I create bash scripts which get sourced from another "main" script to set up variables needed by the main script. These variables need to be able to contain any character and not have them ...
Peter Grill's user avatar
  • 1,613
4 votes
2 answers
4k views

Makefile shell ignoring sed regexp end of line

I have a folder for various testing of C code, containing many files named *.c. My aim is to have a Makefile search for any filename ending in .c and add the root of that filename to the targets. ...
gnucchi's user avatar
  • 502
1 vote
2 answers
10k views

Putting a single quote in a filename [duplicate]

We can a make a directory named $"dollars"&<>\dogs if we surround it with single quotes like the following mkdir '$"dollars"&<>\dogs' However, what if I want to include a single ...
alkabary's user avatar
  • 1,519
2 votes
2 answers
1k views

What other special characters are there?

For filenames, I know that you have to use either a double quotes or a backslash to include a space in your file name. Like mkdir "I like coffee" is the same as mkdir I\ like\ coffee Now when you ...
alkabary's user avatar
  • 1,519
7 votes
1 answer
3k views

Representing/quoting NUL on the command line

Can \0 be used on the command line? Background For testing corner cases in GNU Parallel I was curious whether all characters were correctly quoted on the command line. Most of them are: perl -e '...
Ole Tange's user avatar
  • 35.7k
5 votes
3 answers
9k views

Help Shell script to pass variables to rsync

I'm trying to create a simple wrapper shell script for rsync. When I send file names to my script, rsync can never seem to identify the correct location. The file names have spaces in them. I've tried ...
Sepero's user avatar
  • 1,619

15 30 50 per page