File: psh.tf

package info (click to toggle)
tf5 5.0beta8-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,372 kB
  • ctags: 2,663
  • sloc: ansic: 25,492; makefile: 131; perl: 103; sh: 79
file content (17 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;;; preferred shell
;; /psh [<command>]
;; Like /sh, but uses ${SHELL} instead of /bin/sh to execute <command>.
;; bug:  barfs on suspend (^Z) because SHELL is really a child of /bin/sh,
;; which doesn't have job control.  Workaround:  don't ^Z during /psh.

/loaded __TFLIB__/psh.tf

/def -i psh = \
    /if ( ({#} > 0) & (SHELL !~ "") & (SHELL !~ "/bin/sh") ) \
        /setenv ARGS=%*%;\
        /def -i -hSHELL -1 -agG ~psh_hook = \
            /echo %% Executing %{SHELL} command: %%{ARGS}%;\
        /@sh exec %{SHELL} -i -c "$$ARGS"%;\
    /else \
        /@sh %*%;\
    /endif