All Questions
5
questions
0
votes
1
answer
2k
views
Print a variable in single quote on bash | Weird Variables
On bash script, I need to pass date as ansible extra variable but getting something single quotes related issues;
...
$DT="03-04-17"
ansible-playbook copy2s3.yml --extra-vars 'cdate={{ "$DT" }}'
and ...
1
vote
1
answer
2k
views
regular expression : with a variable
arrFormat=( jpg jpeg bmp tiff png )
varExtension="jpg"
for elem in "${arrFormat[@]}"
do
echo "${elem}"
# do something on $elem #
done
#for i in $( find -E . -iregex '.*\.($arrFormat)' ) ; do #...
1
vote
0
answers
76
views
Take the unknown contents of variable as literal in sed [duplicate]
I have two files: a.patterns contains patterns in a one per line way
"`"
"^"
"<"
"<("
"<)"
"<["
"="
">"
"_;|^+*+?@"
and b.data contains comma separated values.
1,1,0,"*",1
2,1,1,"*",...
2
votes
1
answer
2k
views
Regex works in shell but not through Perl script
I'm having trouble executing a Perl script through the Unix shell using Perl's system command.
I've had more complex regex commands I had to adjust accordingly to convert from Unix to Perl, and they'...
17
votes
2
answers
24k
views
Why do I have to escape a "dot" twice?
I know that we can escape a special character like *(){}$ with \ so as to be considered literals.
For example \* or \$
But in case of . I have to do it twice, like \\. otherwise it is considered ...