-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSUBSHELL-IN-LINUX.txt
More file actions
28 lines (18 loc) · 856 Bytes
/
SUBSHELL-IN-LINUX.txt
File metadata and controls
28 lines (18 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
https://bash.cyberciti.biz/guide/What_is_a_Subshell%3F
https://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/subshells.html
https://www.linuxjournal.com/content/bash-sub-shells --> IMP
https://docstore.mik.ua/orelly/unix3/korn/ch08_06.htm
#!/bin/bash
# allprofs.sh: Print all user profiles.
# This script written by Heiner Steven, and modified by the document author.
FILE=.bashrc # File containing user profile,
#+ was ".profile" in original script.
for home in `awk -F: '{print $6}' /etc/passwd`
do
[ -d "$home" ] || continue # If no home directory, go to next.
[ -r "$home" ] || continue # If not readable, go to next.
(cd $home; [ -e $FILE ] && less $FILE)
done
# When script terminates, there is no need to 'cd' back to original directory,
#+ because 'cd $home' takes place in a subshell.
exit 0