backticks

perl backticks: use bash instead of sh

Hi, I noticed that when I use backticks in perl the commands are executed using sh, not bash, giving me some problems. How can I change that behavior so perl will use bash? PS. The command that I'm trying to run is: paste filename <(cut -d \" \" -f 2 filename2 | grep -v mean) >> filename3 ...

How do I receive command output immediately?

Hi, I'm using perl back-ticks syntax to run some commands. I would like the output of the command to written to a file and also printed out to stdout. I can accomplish the first by adding a > at the end of my back-ticked string, but I do not know hot to make the output be printed as soon as it is generated. If I do something like prin...

Bash: escape characters in backticks

I'm trying to escape characters within backticks in my bash command, mainly to handle spaces in filenames which cause my command to fail. The command I have so far is: grep -Li badword `grep -lr goodword *` This command should result in a list of files that do not contain the word "badword" but do contain "goodword". ...

How do I mock Perl's built-in backticks operator?

I'd like to unit test a Perl program of mine that is using backticks. Is there a way to mock the backticks so that they would do something different from executing the external command? Another question shows what I need, but in Ruby. Unfortunately, I cannot choose to use Ruby for this project, nor do I want to avoid the backticks. ...

creating tidy shell script from ugly command line pipeline

Hi I wrote a piped shell command that has multiple pipes in it that works great. I now want to put this in the form of a (tidy) shell script. Here is the script: #!/bin/bash for number in `cat xmlEventLog_2010-03-23T* | sed -nr "/<event eventTimestamp/,/<\/event>/ {/event /{s/^.*$/\n/; p};/payloadType / {h; /protocol/ {s/.*protocol=\"(...

What do backticked options mean?

I noticed this command: gcc -Wall `libnet-config --defines` libnet-example-x.c -o libnet-example-x `libnet-config --libs` What is the meaning of libnet-config --defines and libnet-config --libs? ...

Escape whitespace when using backticks.

I've had a search around, and from my perspective using backticks is the only way I can solve this problem. I'm trying to call the mdls command from Perl for each file in a directory to find it's last accessed time. The issue I'm having is that in the file names I have from find I have unescaped spaces which bash obviously doesn't like. ...

Problem with backticks in shellscript

I am having a problem getting my shellscript working using backticks. Here is an example version of the script I am having an issue with: #!/bin/sh ECHO_TEXT="Echo this" ECHO_CMD="echo ${ECHO_TEXT} | awk -F' ' '{print \$1}'" result=`${ECHO_CMD}`; echo $result; result=`echo ${ECHO_TEXT} | awk -F' ' '{print \$1}'`; echo $result; The...