19,987 reputation
34475
bio website
location United States
age
visits member for 3 years, 2 months
seen 36 mins ago

Debian user, GNU/Linux enthusiast, FLOSS supporter, hobby developer.


May
27
comment Some puzzles of how to close file descriptors on sh or bash
See also this question: unix.stackexchange.com/q/131801/9537
May
27
comment shell or python script to transpose rows to columns
Try unix.stackexchange.com/q/79642/9537, and stackoverflow.com/q/1729824/855954
May
26
comment compare columns in a one file and print the count of matches
@RincyRaphael I am only answering what you have in your question. If you want something put it in your question. Your question says "Expected output: 2" so that is what I gave you. If you want something else ask for it. I can not read your mind.
May
26
comment compare columns in a one file and print the count of matches
@RincyRaphael I see your new question edit. If you don't ask the right question you won't get the right answer. I will ask again - are there blank lines in your input like you have in your question?
May
20
comment Difference between cat and '>' to zero out a file
@StephaneChazelas What do you make of 1.c in Command Search and Execution? The way I interpret it, true must bypass PATH lookup and unless a shell hardcodes a fixed path to an external true binary, the only way it can meet that requirement is to make the listed utilities built-in.
May
20
comment Difference between cat and '>' to zero out a file
There is a time and a place for everything. Your information may be useful in some other context but it does not belong here - you should find a more appropriate place for it because nobody trying to rotate logs is going to look in this completely unrelated redirection question. Here your answer is the equivalent of a digital weed, just as an otherwise useful pumpkin plant in the middle of a cornfield would be considered a weed.
May
19
comment How to fix the accents in xterm top bar?
Try using the Debian uxterm or lxterm wrappers.
May
19
comment Difference between cat and '>' to zero out a file
Very little of this answer actually is relevant to or answers the question. The difference between a cat /dev/null > file and a > file is a cat /dev/null and that makes no difference to the file.
May
19
comment Difference between cat and '>' to zero out a file
@Patrick The phrase "special utility" does not appear anywhere. The link I gave explains the difference between a special built-in and a regular built-in: however, the special built-in utilities described here differ from regular built-in utilities in two respects: ... What do you mean by special utility?
May
19
comment Difference between cat and '>' to zero out a file
@kojiro : is also mandated by POSIX to be built-in, and in fact is different from true in that it is considered a "special" built-in.
May
16
comment Some puzzles of how to close file descriptors on sh or bash
You raise a good point about <>. It appears POSIX may be a bit under-specified here, and there does not seem to be a "good" answer to your question. If you need to use <> in a POSIX environment, it seems like a fairly safe assumption that on most implementations any one of >&- and <&- will work though.
May
16
comment To env or not to env
@JohnCromartie It's an optional component of every shell command, so it is in the "Simple Commands" section of most shell manuals. For POSIX, that would be here. glenn linked the analogous section from the bash manual for you already.
May
16
comment Some puzzles of how to close file descriptors on sh or bash
In practice, closing a file descriptor in the shell probably means using the close() system interface, which works on all file descriptors regardless of what mode they were opened in. This is probably why closing shell file descriptors with the wrong operator still works. However, nowhere does POSIX guarantee this will work, so it would be unwise to rely on such behavior.
May
16
comment Some puzzles of how to close file descriptors on sh or bash
Your syntax is wrong. To close a descriptor you need &-. A - by itself creates a file called -. You probably have a few of those from your testing now.
May
15
comment Can grep be used for searching files with some string in their names?
@Tim You have to understand that grep only looks at content, whether by opening files or in standard input. If you want grep to look at filenames, you have to put file names in its content. Either store the list of filenames in a file or pass it to grep on its standard input. Neither way is recommended - it is like using a hammer on a screw, i.e. wrong tool for wrong job.
May
15
comment Can grep be used for searching files with some string in their names?
@Tim Here you go: oxforddictionaries.com/definition/english/grep
May
14
comment How do I access the Lubuntu menu in Openbox?
Does this question from AskUbuntu help?
May
14
comment How to Execute multiple command using nohup
Probably. I think when I wrote the answer I just copied it from the question.
May
8
comment can't get hello world shell script to run in FreeBSD
This is common to nearly every Unix-like system, and is not specific to (Free)BSD.
May
5
comment Have backticks (i.e. `cmd`) in *sh shells been deprecated?
@mikeserv ((expression)) is a bash-ism. At this point you have lost me. What are you talking about?