Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bash -c "some_program with its arguments"
- ( exec sh -i 3<<SCRIPT 4<&0 <&3 ⏎
- echo "do this thing"
- echo "do that thing"
- exec 3>&- <&4
- SCRIPT
- )
- . ./script
- ( exec sh -i 3<<SCRIPT 4<&0 <&3 ⏎
- echo "do this thing"
- echo "do that thing"
- $(cat /path/to/script)
- exec 3>&- <&4
- SCRIPT
- )
- % printf 'echo "%s"n' "These lines will print out as echo"
- "statements run from my interactive shell."
- "This will occur before I'm given the prompt." >|/tmp/script
- % ( exec sh -i 3<<SCRIPT 4<&0 <&3
- echo "do this thing"
- echo "do that thing"
- $(cat /tmp/script)
- exec 3>&- <&4
- SCRIPT
- )
- sh-4.3$ echo "do this thing"
- do this thing
- sh-4.3$ echo "do that thing"
- do that thing
- sh-4.3$ echo "These lines will print out as echo"
- These lines will print out as echo
- sh-4.3$ echo "statements run from my interactive shell."
- statements run from my interactive shell.
- sh-4.3$ echo "This will occur before I'm given the prompt."
- This will occur before I'm given the prompt.
- sh-4.3$ exec 3>&- <&4
- sh-4.3$
- % man set
- −b This option shall be supported if the implementation supports the
- User Portability Utilities option. It shall cause the shell to
- notify the user asynchronously of background job completions. The
- following message is written to standard error:
- "[%d]%c %s%sn", <job-number>, <current>, <status>, <job-name>
- where the fields shall be as follows:
- <current> The character '+' identifies the job that would be
- used as a default for the fg or bg utilities; this
- job can also be specified using the job_id "%+" or
- "%%". The character '−' identifies the job that
- would become the default if the current default job
- were to exit; this job can also be specified using
- the job_id "%−". For other jobs, this field is a
- <space>. At most one job can be identified with '+'
- and at most one job can be identified with '−'. If
- there is any suspended job, then the current job
- shall be a suspended job. If there are at least two
- suspended jobs, then the previous job also shall be a
- −m This option shall be supported if the implementation supports the
- User Portability Utilities option. All jobs shall be run in their
- own process groups. Immediately before the shell issues a prompt
- after completion of the background job, a message reporting the
- exit status of the background job shall be written to standard
- error. If a foreground job stops, the shell shall write a message
- to standard error to that effect, formatted as described by the
- jobs utility. In addition, if a job changes status other than
- exiting (for example, if it stops for input or output or is
- stopped by a SIGSTOP signal), the shell shall write a similar
- message immediately prior to writing the next prompt. This option
- is enabled by default for interactive shells.
- % kill -l
- > HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS
- # hitting 'C-z C-z' will run Ctrl+Z (SIGTSTP, suspend as usual)
- bind ^Z stuff ^Z
- # hitting 'C-z z' will suspend the screen client
- bind z suspend
- % fg
- % bg
- bash -i <<< 'some_program with its arguments; exec </dev/tty'
- if [[ -n "START_COMMAND" ]]; then
- start_command="$START_COMMAND"
- unset START_COMMAND
- eval "$start_command"
- fi
- START_COMMAND='some_program with its arguments' bash
- bash -c "some_program with its arguments;bash"
- bash -c "
- trap 'select wtd in bash restart exit; do [ $wtd = restart ] && break || $wtd ; done' 2
- while true; do
- some_program with its arguments
- done
- "
- 1) bash
- 2) restart
- 3) exit
- bash -c "some_program with its arguments; bash"
- some_program with its arguments &
Add Comment
Please, Sign In to add comment