Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
1 answer
60 views

function set_trap_for_exception() { function _on_error() { echo "error start" exit 1 } trap '_on_error "$BASH_COMMAND" $LINENO' ERR } function is_hygon_cpu() { ...
4 votes
1 answer
122 views

I would like to have function change value of global variable, but it fails when the function is used in a pipe: #!/bin/bash declare GVAR="abc" func1() { read GVAR echo>...
0 votes
4 answers
173 views

I would like to do equivalent of name referencing from a function run in a subshell, so that arbitrary variable (e.g. associative array) is then available in the parent. Note on duplicates: I found ...
2 votes
2 answers
83 views

I'm creating a script where multiple outputs from background processes are captured through while-read loop. However, it only works if I capture output directly to while loop. Trimmed down version of ...
1 vote
1 answer
63 views

I have complex multi-step 'init' operations which can be ignored when they work. Having the echoed commands and their output at the beginning of every operation swamps the output you care about. I ...
2 votes
1 answer
151 views

I'm struggling with why an errexit a.k.a. set -e is not passed into a command substitution subshell (invoked with $(my-command) or backticks), but it is passed into a regular subshell (invoked with (...
1 vote
2 answers
103 views

I've a shell script and a python script organized as follows (CAN NOT change the directory structure): ~ ├── a.py ├── b └── c.sh The MWEs are as follows: c.sh #!/bin/sh rcfile=$(mktemp) export ...
1 vote
1 answer
76 views

In Bash, running the following: ( sleep 50 > /dev/null 2>&1 &) && exit 0 exits before my human eye can even notice. But if I list commands within the group ( sleep 50 &&...
1 vote
1 answer
82 views

Doing some tests, I discovered that setting the bash shebang in a script would cancel the $BASH_SUBSHELL behavior. # in the terminal $ echo $BASH_SUBSHELL 0 $ (echo $BASH_SUBSHELL) 1 ...
Top Dawn's user avatar
0 votes
4 answers
91 views

Code is to match '(' with ')' and '{' with '}'. My problem is that the way I did is request to pop() is creating subshell. Is there a way to modify it with locale -n or some new features from bash 4.3&...
0 votes
0 answers
168 views

I have a bash script where I spawn a program in a subshell and wait for it to finish: #!/usr/bin/env bash set -m ( theprogram & echo $! > "${PROGRAM_PID}" ) set +m tail --pid &...
Maestro's user avatar
  • 9,876
0 votes
1 answer
245 views

Normal command chaining methods work normally, for instance: $ (SCRATCH='heya'; echo $SCRATCH) heya Or using the logic operator && yields predictable results: $ (SCRATCH='heya' && ...
0 votes
3 answers
127 views

Let's consider 2 text file, one 'main_list', and one 'ignore_list'. For each line in the ignore_list, I want to remove the line starting with that string in the main_line. basically something doable ...
EricBDev's user avatar
  • 1,613
0 votes
0 answers
202 views

"Way back in the day", mid 1990s, I had to write a C program I called "readline" to avoid the global vs local variable issue created by subshelling when one did a construct like: ...
Richard T's user avatar
  • 4,695
0 votes
1 answer
127 views

I have done some research on pipe and subshell Each command in a multi-command pipeline, where pipes are created, is executed in its own subshell, which is a separate process (see Command Execution ...
matrixzj's user avatar

15 30 50 per page
1
2 3 4 5
...
21

AltStyle によって変換されたページ (->オリジナル) /