FAQ Database Discussion Community


Quoting in sh bash … (“”) ($'') ('')

bash,shell,quoting
I hopefully would like to say I understand quotings used in BASH and their difference , " ", ' ', $' '. I saw many shell scripts containing IFS=$'\n' but NO IFS="\n" It looks at least to me that there is no difference. and in my environment both work correctly...

'mutt' does not show full subject

linux,shell,ssh,quoting,mutt
I use following shell script to send email. But the subject of email always shows "This" instead of "This is L_1.R". program=("L_1" "L_2" "L_3" "L_4") subject="The job is finished" ssh -f c15-0330-01.ad.mtu.edu 'echo' "the job ${program[0]} is finished" '|' 'mutt "[email protected]" -s' "This is "${program[0]}".R"; ...

Why does postgresql fail on single quote

c#,postgresql,programmatically-created,quoting
I am trying to programmatically create the postgresql (9.2) "pg_hba.conf" file during our install. I have tried to create the file using the following: (yes, the Windows 8.1 User Name has a space and an apostrophe) private static string[] CreatePgHbaContents() { string[] configLines = { "# TYPE DATABASE USER ADDRESS...

R data.table: reuse an aggregation

r,expression,data.table,aggregate,quoting
I want to apply the same aggregation to multiple data tables, without rewriting the aggregation scheme. Consider dt1 <- data.table(id = c(1,2), a = rnorm(10), b = rnorm(10), c = rnorm(10)) dt2 <- data.table(id = c(1,2), a = rnorm(10), b = rnorm(10), c = rnorm(10)) dt1_aggregates <- dt1[, .(mean_a=mean(a), sd_a=sd(a),...

Safely pass Make variable to shell commands

shell,make,escaping,quoting
Consider this Makefile: VAR1=oneword VAR2=two words VAR3=three" quoted "words test: printf '>%s< ' "$(VAR1)" "$(VAR2)" "$(VAR3)" @echo If I run it, I get $ make test printf '>%s< ' "oneword" "two words" "three" quoted "words" >oneword< >two words< >three< >quoted< >words< print but I would like to get the same...

How to properly escape quotes inside form INPUT attribute assignments?

attributes,cgi,quoting
I have various things that need to end up in a CGI form, thus: <INPUT TYPE="TEXT" SIZE=64 MAXLENGTH=64 NAME="name" VALUE="thing"> ...my understanding (limited, but I'm learning) is that CGI inputs require double quotes as delimiters. However, some of the things I need to put in there have double quotes. Some...

find command works on prompt, not in bash script - pass multiple arguments by variable

linux,bash,shell,scripting,quoting
I've searched around questions with similar issues but haven't found one that quite fits my situation. Below is a very brief script that demonstrates the problem I'm facing: #!/bin/bash includeString="-wholename './public_html/*' -o -wholename './config/*'" find . \( $includeString \) -type f -mtime -7 -print Basically, we need to search inside...

Bash, get normal strings to behave like [email protected] vs $*

bash,quoting
Solution: I eventually got it with bash arrays, my solution is here. Question: In bash, I can have a function whose arguments have spaces, and I can use [email protected] or $* to get the quoting right: $ _() { ruby -e 'p ARGV' "[email protected]"; }; _ 'a b c' '1...