View Single Post
Old 09-03-2012, 10:21 AM   #51
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
okay so. back to that little mystery later.

Onwards to the test:

STATE YOUR ASSUMPTIONS:

1) old netcat will choke on extra -p -l flags

2) new netcat works and in place

3) .alias trick will pass the call to the new nc

4) subshells will be passed through the .alias layer.

Okay next - What is a subshell?

http://docstore.mik.ua/orelly/unix/upt/ch38_04.htm

Quote:
Subshells

In UNIX, when a program starts another program (more exactly, when a process starts another process), the new process runs as a subprocess or child process. [1] When a shell starts another shell, the new shell is called a subshell . [2]

[1] This isn't true when the subprocess is exec d from the parent process without a fork first.

[2] When you use the shell's exec command, it does not start a subprocess.

So what? There are some important things to know about it: the child process gets a copy of its parent's environment. Any changes in the environment of the child process aren't passed to its parent. "Still," I hear you say, "so what??"

Shell scripts are run in a subshell (unless you use the source or . commands to start the script). If the script makes changes to the environment of its (sub)shell, the parent shell won't see those changes. If the script uses cd , it doesn't change the current directory in the parent shell. If the script changes the value of the TZ (or any) environment variable , that won't change TZ in the parent shell. The script can set a different umask than the parent shell - no problem.

There are times you might want to start a subshell from your current shell. Maybe you have a special project where you need to work in a different current directory, reset environment variables, set a new home directory, reset some aliases, use a different PATH, whatever. When you end the subshell, the parent shell's environment will be the way it was.
so a simple test would be to type su and try again

[root@kindle us]# su
[root@kindle root]# grep --version
grep: unrecognized option `--version'
BusyBox v1.7.2 (2011-09-08 21:57:14 PDT) multi-call binary

Usage: grep [-HhrilLnqvsoeFABC] PATTERN [FILEs...]

Fail *gets out the welding gear and digs around some more*
twobob is offline   Reply With Quote