96,234 reputation
12114239
bio website
location European Union
age
visits member for 2 years, 3 months
seen 2 hours ago

20h
revised Filtering invalid utf8
added 4 characters in body
23h
comment Switch to parent shell without logging out
@nyuszika7h, $$ may be readonly, but IFS is not. Try IFS=0123456789; suspend in ksh for instance.
23h
comment Switch to parent shell without logging out
Note that there's no guarantee that 19 will be the number of SIGTSTP. Use kill -s TSTP or kill -s STOP (TSTP can be trapped or ignored, STOP cannot).
23h
comment Switch to parent shell without logging out
bash does not trap CTRL-Z, when you press CTRL-Z, your terminal emulator sends a ^Z character (0x1a) to the master side of the pty device. The line discipline of the pty driver then sends SIGTSTP to the foreground process group of the terminal. Until then bash is not involved at all. That SIGTSTP may cause the process group leader to suspend and then the wait() that bash does on it will return.
23h
comment Switch to parent shell without logging out
@nyuszika7h, not-quoting variables is the split+glob operator. It makes no sense at all to invoke it here. The behaviour of the split part depends on the current value of $IFS. See also Security implications of forgetting to quote a variable in bash/POSIX shells.
1d
awarded  Necromancer
1d
comment Filtering invalid utf8
Sorry, my bad, the behaviour is unspecified in POSIX since grep is a text utility (only expected to work on text input), so I suppose GNU grep's behaviour is as valid as any here.
1d
answered Filtering invalid utf8
1d
comment Switch to parent shell without logging out
@Mikel, zsh or csh, tcsh, or bash, or the Bourne shell or ksh... (in ksh, suspend is an alias for 'kill -s STOP $$' (note the bug with the missing quotes around $$)).
1d
comment Filtering invalid utf8
The python 2 one fails to flag UTF-8 encoded UTF-16 surrogate non-characters (at least with 2.7.6).
1d
comment Filtering invalid utf8
Except for -a, that's required to work by POSIX. However GNU grep at least fails to spot the UTF-8 encoded UTF-16 surrogate non-characters or codepoints above 0x10FFFF.
1d
revised How was the Shellshock Bash vulnerability found?
deleted 1 character in body
1d
awarded  Revival
1d
comment What is the correct syntax for cloning a ntfs partition to a sparse file on another ntfs drive?
Use ntfsclone which only copies the allocated sectors.
1d
answered How was the Shellshock Bash vulnerability found?
1d
revised mv multiple files same dir without specifying same path or each
added 2 characters in body
2d
comment calendar to check the date and then search 3 months back and add up the days of those months?
Note that that syntax is zsh, not bash. In bash, you need to quote variables and arithmetic expansions.
2d
comment calendar to check the date and then search 3 months back and add up the days of those months?
For GNU date, 3 months ago on 2014-05-31 is 2014-03-03. You'll also be off by one day when across one of the DST shifts in timezones where they apply. For instance, there are 89 days between 2014-02-21 and 2014-05-21, but your solution would report 88 in most timezones that change their clock for daylight saving.
2d
comment calendar to check the date and then search 3 months back and add up the days of those months?
What should the result be on the 31st of May?
2d
comment Can Process id and session id of a daemon differ?
It's also common practice to fork after the setsid to avoid being a session leader, so that if ever the process opens a file and that file happens to be a tty device and you forgot to pass the the O_NOCTTY flag, it doesn't end up controlling the terminal. (which is why it's not uncommon to have sid != pid for a daemon, for instance Debian's start-stop-daemon -b does that).