Questions tagged [subshell]

A subshell refers to a shell invoked from within a parent shell. It is an example of a child process. Questions with this tag may involve any issue with working with subshells. Please also include tags for platform or shell language.

Most questions with this tag involve the Bash shell, as that is a very popular shell language. However this could relate to any platform, command-line application, or shell that allows the creation of subshells.

295 questions
0
votes
2 answers

bash script works on bootup, doesn't in terminal

I'm creating a server in Amazon ec2 and passing it a bash script as userdata, which is run when the server first boots. It includes a command to add a line to crontab for a user using the answer given…
Danack
  • 24,939
  • 16
  • 90
  • 122
0
votes
2 answers

How to get standard output from subshell?

I have a script like this? command='scp xxx 192.168.1.23:/tmp' su - nobody -c "$command" The main shell didn't print any info. How can I get output from the sub command?
Yuxuan
  • 71
  • 7
-1
votes
1 answer

ruby backtick, kernel.system, exec , command does not succeed

I am trying to execute a java program form my ruby code. My code is something like: cmd = "java -cp \"path/lib/*\" com.blah.blah" # %x[#{cmd}] # `#{cmd}` # Kernel.system(cmd) Kernel.exec(cmd) My problem, is the command does not…
codeObserver
  • 6,521
  • 16
  • 76
  • 121
-1
votes
1 answer

Stop subshell with background process from receiving SIGINT despite trapping signals in the foreground

Let us say I have a function that is run in the foreground. This function traps SIGINT and ignores EOF (for preventing Control + C and Control + D). This function creates a subshell that runs a command in the background. I would think that SIGINT…
Gigi Bayte 2
  • 838
  • 1
  • 8
  • 20
-1
votes
1 answer

Shell script - Output to both the terminal and a log file in a sub-shell

I have a few shell scripts that are intended to work together. The first script (script1.sh) calls the next script in a sub-shell. The second script (script2.sh) needs to "return" something for the first script to use. I need the last line that is…
Ebad
  • 131
  • 11
-1
votes
1 answer

Makefile executes $(shell command) unordered

I am having an issue with my Makefile: At the begining of the Makefile, a file is created. I wanna retrieve the content of that created file by using the "cat command". I need to use the $(shell cat) execution because I have to retrive it inside…
user2607702
  • 41
  • 1
  • 6
-1
votes
1 answer

root undoing previous changes after sudo su user

I am having a hard time with root whenever i run sudo su and then nano ~/.zshrc, edit my file to add PATHs followed by a source ~/.zshrc, it works just fine. That until i run sudo su myuser to go back to my default user. When i do that all my…
klferreira
  • 322
  • 1
  • 4
  • 11
-1
votes
2 answers

How to execute Python files from Python?

I am attempting to execute Python files from a deconstructed file. import utils import os print(utils.fileReader('holderFile.py')) test = utils.fileReader('holderFile.py') for i in test: if(i == ''): os.system('') #this allows for it to…
Marc Frame
  • 923
  • 1
  • 13
  • 26
-2
votes
1 answer

Bash script not ending because of the background processes

I have a bash script as given below: It runs the python script with different arguments, each one as a background process (note that I have used '&') #!/bin/bash declare -a arr=("arg1" "arg2" "arg3") for i in "${arr[@]}" do echo "$i" python3…
techtie
  • 11
  • 4
-2
votes
1 answer

Is it possible to run a KSH command within an expect script?

I simply want to source KSH with: . ./.kshrc within an expect script. Is it possible to source KSH and run a KSH command within an expect script?
NickaBrick
  • 81
  • 1
  • 12
1 2 3
19
20