Questions tagged [quoting]
Strings are typically delimited by quotes, which raises the problem of dealing with strings that include quotes.
24
questions with no upvoted or accepted answers
4
votes
0
answers
294
views
How to explicitly set the tabname of a new gnome-terminal?
I want to explicity rename a tab in gnome-terminal on startup of the tab. I don't want to use gnome-terminal --title flag as that gets reset by my systems bashrc file after whatever else is supposed ...
3
votes
1
answer
115
views
zsh fail to keep unquoted `$*` and `$@` equal
All shells tested do the same for the (quoted) pair "$*" and "$@" with this code:
c='set a b @ c; IFS=:,@ ; a=$(printf "<%s> " "$*"); b=$(printf "<%s> " "$@"); printf "%-20s and %-20s\n" "...
2
votes
0
answers
3k
views
How to escape all of the special characters in order to be able to print the string as is?
I'm creating a tcsh script on the fly (with a static language). I have a <add-command-here> section that contains some command. I want to do:
echo <add-command-here>
In that <add-...
2
votes
1
answer
180
views
awking for command options from man page
I am trying to auto-generate tab-completions for different commands. I am piping man pages for different commands into awk, then searching for command line options (eg. -shortopt --long-option) ...
2
votes
0
answers
318
views
Passing external parameter to .exe on Windows using winexe from Linux
I am trying to execute a .exe on Windows from Linux using winexe. This exe requires an external parameter (string) to be fed alongwith. With the following command I have succeeded in initialising the ....
1
vote
2
answers
382
views
How to execute function within double quotes?
I have these function:
#execute vim and then exit on err return
ve() {
vim "$@" || exit
}
export -f ve
#compile c source -> asm source in new tab in xfce terminal
casm() {
[ -z ${1} ] &&...
1
vote
0
answers
3k
views
Hmac with openssl's command line tool with a key that might contain null bytes
Let's say I want to do an SHA256HMAC digest of a file with the openssl command line utility:
openssl dgst -sha256 -hmac "$(cat $KEY_FILE)" -hex "$TARGET_FILE"
How can I protect this command against ...
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/...
1
vote
1
answer
610
views
Escaping bash variables before storing them in an apache hive database
I'm running a script file sqoop_import_ATM.sh and would like to store the logs in a SQL database.
First thing I did was to direct the logs into my own variable:
OUTPUT="$(/home/me/...
1
vote
0
answers
217
views
How to make tcsh not insert whitespace in a command that spans multiple lines
Bash does not seem to insert whitespace but tcsh does.
Tcsh
bash-3.2.25$ tcsh -c 'echo $tcsh; echo A\
> B'
6.14.00
A B
Bash
bash-3.2.25$ bash -c 'echo A\
> B'
AB
How can I ask tcsh to not insert ...
0
votes
1
answer
16
views
SLURM_* variables causing syntax errors in multi-node HPC environment
My set up is as follows:
A bash script that accepts a number of parameter (like how many nodes to use, which model to train, etc.). This is the job that I submit to the SLURM job queue
This bash ...
0
votes
0
answers
74
views
Why are my strings being truncated including and after an equals sign?
I was writing a shell script for inserting a string value through a Microsoft sqlcmd variable into a Microsoft SQL server database table and noticed some unexpected behavior. It appeared the trailing ...
0
votes
0
answers
28
views
In the nullmailer `remotes` configuration file, how do I quote single quotes in the password?
I'd like to use nullmailer to have my Debian (bullseye and bookworm) systems send system-generated email messages to the appropriate recipient. nullmailer is configured (among others) by the file /etc/...
0
votes
2
answers
884
views
How to properly parse a quoted arg-list string in a shell script?
Summary
How to convert a single string a "b" 'c d' $'e\nf' into separate arguments, respecting quotes and preserving whitespaces and newlines?
Question
I'm trying to read and process the ...
0
votes
1
answer
244
views
dash: How can I quote the arguments ala "${(q+@)@}" in zsh?
I want to quote the arguments in dash (or sh, or even bash if that's not possible). I can do that with "${(q+@)@}" in zsh, such that reval <sth> ... is the same as just typing in <...