Reputation
110,696
Next tag badge:
399/400 score
103/80 answers
Badges
17 137 278
Newest
 Guru
Impact
~4.0m people reached

3h
answered Concat 1000 files within a directory
4h
revised Terminal does not accept pasted or typed lines of more than 1024 characters
added 303 characters in body
13h
comment bash: Assigning the first line of a variable to a variable
@Gilles, the last supported OS that included bash-2.03 (released 16 years ago) was probably Solaris 8 which went EOL over 3 years ago. That hypothesis seems pretty unlikely.
13h
comment Terminal pty name according to the source IP address
pty have nothing to do with tcp/ip. sshd happens to listen for incoming TCP connections, create pipes and create pty pairs and somehow sending and receiving data on all of those after processing. There's nothing that ties a pty to a TCP connection other than a command (here sshd) meant to do things with both. Same for xterm. it does a TCP (or unix domain) connection to a X server and creates a pts pair. The script command creates a pts and doesn't connect to anything excape maybe a LDAP server for username resolution...
15h
comment Error in file comparison - awk
NR==FNR is a more efficient and idiomatic way to check that you're processing the first file (unless the first file may be empty)
15h
comment Stable sort a file by presence of ordered substrings on each line
Sounds like G-Man nailed it then.
15h
answered Hard Disk Clone Image Size
15h
comment Terminal pty name according to the source IP address
So, do you want for instance the list of pts that are controlled by a sshd process and for them give the IP address of the peer that spawned that sshd process?
16h
comment Stable sort a file by presence of ordered substrings on each line
You mean you want the lines containing usb moved to the top, not sort them?
19h
comment Hard Disk Clone Image Size
Yes, but you apply it to the dd that reads from the pipe, not the dd that reads from the disk. gzip stores the file size in a 32bit integer so gzip -l output is not helpful for files bigger than 4GB. That was a bad advise of mine sorry.
19h
comment Is CDPATH behavior broken in bourne shell (/bin/sh)
According to in-ulm.de/~mascheck/bourne, CDPATH was added to the Bourne shell in SVR1 (1983) so probably before ksh. The feature comes from csh anyway (cdpath variable).
19h
comment Hard Disk Clone Image Size
Note that the dd of=sda1.gz conv=sync,noerror makes no sense. Those conv=sync,noerror should have gone to the dd if=/dev/sda1 one. See gzip -l to get the uncompressed size.
20h
comment Terminal pty name according to the source IP address
Are you looking for something like what who reports (based on utmp information) (or who --ips)? Note that ptys can be used for all sorts of things, not only network terminal sessions.
21h
comment Converting relative path to absolute path
There's one case of missing quotes in dirname $cwd
21h
comment Converting relative path to absolute path
Your case check should be ..|../*) instead of ..*.
21h
comment Converting relative path to absolute path
Your forget to check the exit status of cd (and pwd). You should probably use cd -P -- as well in case the 1st argument contains some ..
21h
comment Converting relative path to absolute path
If you drop Bourne compatibility, then you can use the POSIX ${var##pattern} syntax and avoid those echo|sed that are going to break with some values.
21h
comment Converting relative path to absolute path
Note that you'll probably only find a Bourne shell on Solaris 10 and earlier nowadays. That Bourne shell like most Bourne shell implementations since SVR2 (1984) has pwd builtin and doesn't support -P (the Bourne shell did not implement that logical $PWD handling like POSIX shells do).
22h
revised Why is nullglob not default?
added 264 characters in body
22h
comment bash: Assigning the first line of a variable to a variable
Also note that using STRINGTEST=(${STRINGTEST[@]}) makes little sense and is equivalent to STRINGTEST=($STRINGTEST) since STRINGTEST was previously defined as a scalar (not array) variable.