Skip to main content

Questions tagged [subshell]

Use where a shell is run inside a shell (nested shells)

0 votes
2 answers
163 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
5 votes
1 answer
340 views

If do this on my bash terminal: ( (sleep 0.5 && echo 'first command, second result' &); (echo 'second command, first result' &); ) then I see: second command, first result ...
k0pernikus's user avatar
  • 16.7k
4 votes
2 answers
364 views

I have a command that takes always the same initial parameters. I can create a variable to capture these parameters. Also, I need to pass the output of a subshell running the same command to the ...
k314159's user avatar
  • 533
4 votes
4 answers
579 views

Given this code: #!/bin/bash set -euo pipefail function someFn() { local input_string="$1" echo "$input_string start" sleep 3 echo "$input_string end" } function ...
k0pernikus's user avatar
  • 16.7k
0 votes
2 answers
105 views

My login shell is Fish, but I would like to execute a shell command (apt install ...) as if my login shell was Bash. Is it possible to make a command/subprocess believe that my login shell is /usr/bin/...
Alexey's user avatar
  • 2,380
4 votes
0 answers
114 views

Why does echo "$(fc -l -1)" show the previous command, but echo "$(fc -l -1 | cat)" show the current command? $ testfc () { > echo "$(fc -l -1)" > echo &...
Jacktose's user avatar
  • 532
0 votes
0 answers
38 views

I have a script which is supposed to fetch 2 URLs sequentially: #!/bin/bash wget_command='wget --restrict-file-names=unix https://www.example.com/{path1,path2}/' $($wget_command) echo $wget_command ...
MonkeyZeus's user avatar
5 votes
2 answers
363 views

mkfifo foo printf %s\\n bar | tee foo & tr -s '[:lower:]' '[:upper:]' <foo wait rm foo This is a working POSIX shell script of what I want to do: printf %s\\n bar is symbolic for an external ...
finefoot's user avatar
  • 3,586
1 vote
0 answers
106 views

In Bash blocks {} and subshells () the exit early doesn't work if there is an OR condition following it. Take for example set -e { echo a; false; echo b; } || echo c prints a b and set -e { echo a; ...
QuickishFM's user avatar
5 votes
1 answer
371 views

I'm experiencing extremely sluggishness in opening subshells (by using ` ` or $( ) command substitutions in scripts) while in ksh on some Linux servers. The same problem does not exist in sh or any ...
Paul W's user avatar
  • 183
1 vote
0 answers
28 views

This command is a simplification of the problem I've come across: ssh grinder1h.devqa sh -c "cd /etc/ssh && pwd" This command gives an output of "/home/fetch", which is ...
CryptoFool's user avatar
3 votes
0 answers
206 views

I have a Debian 12 (bookworm) host where I run three VMs using QEMU / KVM. To simplify VM management, each VM has a QEMU monitor socket. These sockets are /vm/1.sock, /vm/2.sock and /vm/3.sock. Among ...
Binarus's user avatar
  • 3,961
0 votes
1 answer
94 views

there is a script, 1.sh. 1.sh starts 1a.sh and then 1b.sh. But how to exit all scripts, how to exit 1.sh and how to not start 1b.sh if 1a.sh breaks with an error?
user447274's user avatar
-2 votes
1 answer
106 views

About bash For a new tty when is executed the echo $SHLVL command it displays 1 as expected. Now, if in the same tty is executed the bash command and later again the echo $SHLVL command it displays 2. ...
Manuel Jordan's user avatar
0 votes
1 answer
458 views

You can give a Flatpak permissions to access files/folders outside of its sandbox using the techniques described in this Ubuntu Stack Exchange QA. But is it possible to give an existing Flatpak ...
Amazon Dies In Darkness's user avatar

15 30 50 per page
1
2 3 4 5
17