Skip to main content

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 ...
Prodnegel's user avatar
  • 141
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" "...
user avatar
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-...
vesii's user avatar
  • 203
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) ...
myc3lium's user avatar
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 ....
KM_Guest_MMP's user avatar
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} ] &&...
Herdsman's user avatar
  • 350
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 ...
martin's user avatar
  • 113
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
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/...
Greg Peckory's user avatar
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 ...
Gowtham's user avatar
  • 2,089
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 ...
Bram Vanroy's user avatar
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 ...
Mark's user avatar
  • 101
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/...
Binarus's user avatar
  • 3,430
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 ...
Christian's user avatar
  • 101
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 <...
HappyFace's user avatar
  • 1,620
0 votes
1 answer
233 views

Output double quotes and variable

I'm writing a script to automate Let's Encrypt in PowerDNS,(this is a simple bash shell script to be run on debian) Certbot runs and calls the script, feeding to it the variable: $CERTBOT_VALIDATION ...
mike's user avatar
  • 1
0 votes
2 answers
980 views

CSV fields max length error and setting quoting=csv.QUOTE_NONE

After running csvcut on a comma-delimited .csv file: [root@server files]# csvcut -c title,mpn,overview,techspecs2,image_carousel_elargesrc syn_multi-image.csv > syn_scraped_cut.csv I get the error:...
ptrcao's user avatar
  • 5,755
0 votes
1 answer
42 views

add a line to file that contains quotes and variable using bash

I want to add this line to /etc/grub.d/00_header set superusers="ubuntu" where ubuntu is the result of $USER. I've tried this: sudo bash -c 'echo "set superusers='"${USER}"'" >> /etc/grub.d/...
Luffy Wallis's user avatar
0 votes
0 answers
282 views

Quoting of SQL excuted via psql via ssh

I want to execute this SQL line: select * from "foo" where name='bar' I call above line "sql_line" in the next statements. Now I want to call this via psql: psql -c sql_line Now I want to call ...
guettli's user avatar
  • 1,449
0 votes
1 answer
982 views

How to launch Notepad++ from the Cygwin command line via an alias?

This is what I tried. $ alias n++='(cd `dirname $1`; "/cygdrive/c/Program Files (x86)/Notepad++/notepad++.exe" `basename $1`)' alias n++='(cd `dirname $1`; "/cygdrive/c/Program Files (x86)/Notepad++/...
Chloe's user avatar
  • 538
0 votes
0 answers
358 views

swap strings of text inside vim using regex

I am working with a file where I need to swap "string A" and "String B's" locations simultaneously with a regex inside the vim. Here is an example line of code: succ_1st=`grep 'resulted in successful ...
user53029's user avatar
  • 2,843
0 votes
2 answers
2k views

Exclude the output from ssh and only log the error if found

typeset -f | sshpass -e ssh -o StrictHostKeyChecking=no user@${IPADDRESS} " $(cat); IFERROR=$(checkscript); echo "$IFERROR"" > ${SSHTEMPFILE} 2>&1 This line...I can't exclude the "...
Vianymoon's user avatar
0 votes
1 answer
51 views

Loop across url with static tokens with Oauth

I need to write a loop where I need to pass a "token" (which is fixed) and a variable (i) in the url. Is there any way I can achieve that? I wrote the following code but it is not working. If I put ...
user3570187's user avatar
0 votes
0 answers
369 views

Zsh - Modify File Completion w/ Quotes

I've been using Zsh recently, and when I complete a file name within quotes, the completion adds a space after the completed file name. Interestingly, this does not occur when I complete directory ...
user avatar