Skip to main content

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.

1 vote
1 answer
42 views

How can I prevent command substitution in arguments from silently swallowing errors? #!/bin/sh set -e echo "Evaluating $(false) should abort." echo "This line should not be executed.&...
V02460's user avatar
  • 113
0 votes
2 answers
144 views

So, I was playing around with this answer, when I found that neither printf_stdin () { read input printf "$input" } sed "/lorem ipsum foobar/ { s/'/'\"'\"'/g s/\...
Grass's user avatar
  • 145
2 votes
1 answer
531 views

how do you supply a literal asterisk * when specifying a filename to a command substitution in bash? Consider the following directory: host:/tmp/backtick-test# ls -l total 0 -rw-r--r-- 1 root wheel ...
Scott's user avatar
  • 103
0 votes
2 answers
88 views

The following question likely does not relate specifically to Vim. I use a Vim example, as this is where I encounter the issue. Working on Ubuntu, I often open multiple files in Vim using tab pages: $ ...
user7543's user avatar
  • 266
1 vote
1 answer
141 views

I'm trying to break a long command substitution on to multiple lines, as discussed in this answer. In a plain command pipeline, both explicit (\) and implicit line continuation work fine: $ echo 'blah ...
Jacktose's user avatar
  • 532
0 votes
1 answer
76 views

I have a file named fileWithOneCommand.txt with just one command as follows ps -aux|head -n 5 then I write a testing shell script named 'test5.sh' with content as follow: file=/home/somepath/...
user1169587's user avatar
0 votes
1 answer
51 views

I am doing a code-study of /lib/lsb/init-functions on mint 20 just to familiarise myself with SystemV init system. There is log_action_end_msg function in it which has this code snippet, TPUT=/usr/bin/...
Saravana's user avatar
  • 193
-4 votes
1 answer
128 views

So doing $(cat /etc/passwd) results in "No such File or Directory" and "$(whereis cat)" results in "command not found" Why is command substitution not working in the ...
jstar100x's user avatar
0 votes
1 answer
141 views

in bash i will run a script that take a look in the folder folder123/ to know how much space is requered for the files they are in there. but this requered value will i multiplie with 1,5 and than ...
user447274's user avatar
1 vote
1 answer
103 views

I have the following simple shell command: for x in $(echo one two three); do echo $x; done When executed, it simply prints one two three on one line, i. e. the result of the command substitution is ...
René Nyffenegger's user avatar
0 votes
1 answer
96 views

I am trying to pass filenames retrieved from everything voidtools via their es.exe command line (it works similarly to mlocate) to an "image previewer" like gwenview or nsxiv (in wsl ...
Daniel Krajnik's user avatar
0 votes
0 answers
50 views

I'm trying to pass a list of image files to open gwenview. The only way that seems to work is to list them on command line. However, some file paths have spaces, so they have to be additionally quoted....
Daniel Krajnik's user avatar
0 votes
3 answers
136 views

I am trying to normalise a data file using the number of lines in a previous version of the data file. After reading these questions, I thought this could work: awk -v num=$(wc -l my_first_file.bed) '{...
Whitehot's user avatar
  • 245
0 votes
2 answers
110 views

basic, innocent question: In bash scripting, why ever using a function, if one can set a variable containing command substitution with the essence of the function - a certain command or set of ...
futurewave's user avatar
-1 votes
1 answer
163 views

I am preparing a script that will try to detect two texts on the same line.  This pattern is present in my application log files, which then further used to identify which file contains the pattern. ...
Piyush Nikhade's user avatar

15 30 50 per page
1
2 3 4 5
28