Questions tagged [command-substitution]

Questions about shell command substitution (such as $(command) or `command`), its mechanism, correct syntax etc. Not to be confused with aliasing.

7 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
245 views

bash/cygwin broken after installing rtool?

Usually I can solve problems on my own (and Google). But recently I am baffled by this strange hiccup. Background: I use a chain of scripts for file-processing (in Windows, under Cygwin. Scripts ...
1
vote
1answer
983 views

Job Control: How to save output of background job in a variable

Using Bash in OSX. My script has these 2 lines: nfiles=$(rsync -auvh --stats --delete --progress --log-file="$SourceRoot/""CopyLog1.txt" "$SourceTx" "$Dest1Tx" | tee /dev/stderr | awk '/files ...
1
vote
0answers
138 views

command substitution within c style for loop in Zsh

I have a function printing a number myFunc() { echo 11 } Now I want to use the number in expression in c style for-loop: for (( i=1; i<=$(myFunc); i++ )); do echo "$i" done Zsh gave me ...
1
vote
2answers
223 views

How do I create a rule for custom flag replacement with C shell?

I want to have the following behavior with grep: grep --java <rest of the command> Where --java would either dynamically convert to --include=*.java or internally be equivalent to it. Is there ...
0
votes
1answer
37 views

Find in command substitution: Empty result inside while, result in command line

I have this bash script to find files recovered by PhotoRec (files I know are there, but because of their number I can't locate them one by one), but the find command doesn't return any results, if I ...
0
votes
1answer
54 views

Use command output as argument in watch command

I have a watch on jq -r '.' $(ls -t | head -1)" The goal is to apply "jq -r '.'" to the most recently modified file in directory. Unfortunately, the command used to know the last modified file is ...
0
votes
1answer
17 views

Unable to resolve $proc_date from the script

I have multiple HQL's, below is the one example. located at : /home/ganesh/CopyJobs/hql/ insert into XYZ.exttbl_form_data PARTITION (load_date="$proc_date") select FORM_DATA_ID,FORM_ID,USER_ID,...