Reputation
1,870
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
4 10
Newest
 Civic Duty
Impact
~153k people reached

May
16
comment Reading keypresses in shell using trap and Unix signals
good and thorough answer!
May
16
comment Reading keypresses in shell using trap and Unix signals
+1 for stating what you attempt to do, instead of just asking about the code snippet. and for the context. very good way to ask a question.
May
12
comment Track certain parameters on some command
ok. I added additional remarks underneath Stephane's (good) answer. my remarks may not be applicable (I think of the .txt as a log file, but it could be something else that can't have dates in it?)
May
12
comment Track certain parameters on some command
+1 for a very good answer. But the op may need to change the check to [ "$#" -eq 2 ] , according to his example. And it could be a good idea to also add the date to "tacked_parameters.txt". And I'd go for the general case (ie, not just track of the 2nd parameters when 2 parameters, but track any parameters) : I'd get rid of the if, and have: printf '%s: %s\n' "$(date '+%Y-%m-%dT%H:%M:%S')" "$0 $*" ? (ie, show the command + all the parameters (note that you still lose some info, for example which parameter's had intra-separators, if any). Portable date close to the iso8601 standard)
May
12
comment Track certain parameters on some command
according to your example (git branch develop) you want to check if "$#" is "2" and not "3" ? ... (2 parameters to the git function)
Apr
20
comment Echo command with AND operator doesn't exit
0 means true. && means : execute the next instructions if and ony if the preceding one was true. therefore what you see is normal.
Apr
13
comment bash execute command for X arguments at a time
+1 but i'd also recommend to do this directly on the remote system using its crontab (if any) or another kind of robust session (screen?). not through a ssh session (or, if through ssh, via a "screen" session, if available on the remote host). ie, anything that will survive a disconnection
Apr
10
comment List all files / binaries in current PATH
I m glad it helped :)
Mar
25
awarded  Civic Duty
Mar
19
comment Why do many commands provide a “quiet” option?
@StéphaneChazelas: you'd be amazed how (parts of) many systems are still that old... (well, actually, not that many ^^ but there are still some)
Mar
16
comment remove ^M from solaris by perl one liner on the same file
what @StéphaneChazelas means at the end of his comment is that the ^M shown there is 1 (special) caracter, displayed as ^M in vi (or with cat -v), but entered with: ctrl + v ctrl + m
Mar
13
comment Date computations without GNU tools
a case .... should always contain the default case, such as for example *) output_error ; exit 1 ;; . Here, any timezone different than one of your 3 cases will be silently ignored.
Mar
11
comment Showing all pages at once with man command
+1, DNUUOC (Definitely Not Useless Use Of Cat)
Mar
10
comment How to read dash files
the recommended way is actually to use ./ prefix. It's the most portable (cf the usenet era's Unix FAQ)
Mar
10
comment /usr/bin/awk: Argument list too long
@brucezepplin : then $ line1 is too big. you can add a "-n 10" arg to xargs, so it breaks the input in 10 arguments chunk, and execute awk ... with these 10 args at the end. But i believe here xargs is not what you want : it changes completely the awk behaviour: instead of feeding awk's stdin, xargs will put the incoming stdin as arguments at the end of the awk command line ! please describe what you try to achieve
Mar
10
answered Is it possible to reverse a command in the bash shell?
Mar
10
comment Is it possible to reverse a command in the bash shell?
to undo the shutdown, see here : stackoverflow.com/a/526330
Mar
10
comment /usr/bin/awk: Argument list too long
@brucezepplin the idea would be to do it all from within awk (which can neatly emulate sed and grep). the only caveat would be if you need the external (= shell level) variables later, in which case you should continue as you are trying to do. where is the xargs, by the way?
Mar
10
comment How can I use a wildcard to match just files, not directories?
+1 for portability (there are a lot of very old systems out there!)
Mar
10
comment Replace \n with blank in a file
so far you have the only correct answer. +1. if i nitpick a bit, I'd add a $ after the n, if you only want to delete the \n that are at the end of each line