540 reputation
211
bio website
location
age
visits member for 1 year, 10 months
seen yesterday

2d
comment Search a pattern and print preceding lines starting with another pattern
You show two “xyz” lines in the input, and you show both of them in the output. Please describe the behavior you want. Do you want the output to continue to the last “xyz” in the file? E.g., if lines 9-12 were “xyz”, “foo”, “xyz”, “bar”, would you want the output to be lines 5-11? I ask because you say, “I need to grep for a pattern (“xyz”) and once I find (it), I need to look for another pattern (“a”) preceding that …”, which sounds like you want find the first “xyz”. Also, what if lines 9-14 were “xyz”, “b”, “a”, “r”, “xyz”, “foo”? Would you want lines 5-13 or just 11-13?
2d
comment Check if content of file has length X and contains only specific characters
Or grep -qE '^[[:xdigit:]]{64}$' myid.id.
2d
comment Spawn login prompt in an X terminal
I don’t understand. Are you saying that, if you delete your thing from /etc/init.d/rc.local, it is no longer possible to login to the console at all (and the only way to login is via the network)? If yes, you have a problem that is far bigger than the question that you are asking. If no, what’s wrong with terminating the X server after “that application dies (for whatever reason)” (quoting from your question)? If you were able to login from the console before you created your /etc/init.d/rc.local thing, but that console login interface is unacceptable to you, please explain.
2d
answered How to view files hidden by a mount on Debian 6
2d
comment How to clear the input in Bash
(1) I over-generalized. Oops. I’ve fixed my answer. (2) You, also, over-generalized. (3) “Also the shell doesn't run in the background.” I never said that it did.
2d
revised How to clear the input in Bash
Added qualifications.
Jul
25
comment Does cat never read from terminal?
The - filename argument allows you to say cat file1 - file2 > great_scott to get cat to read first from file1, then from the terminal, and then from file2.
Jul
25
comment Creating an alias for a bash script
I don’t understand how the first paragraph is important – unless menuScript.sh has not been chmod’ed to executable, it which case the error message would have been “Permission denied”. I suspect that forcing a reread of the .bashrc file is the answer. … … … … … … … P.S. The shell knows what to do with the path the same way it does if the user types ./menuScript.sh – by trying to execute the file.
Jul
25
comment “command | less” vs “less <(command)”
I believe that you’re a bit confused on the nomenclature. <(command) is process substitution. Changing that to < <(command) is just making it complicated.
Jul
25
answered How to clear the input in Bash
Jul
25
comment How to view files hidden by a mount on Debian 6
What do you get if you mount --bind /tmp /tmp/BAR?
Jul
25
comment Spawn login prompt in an X terminal
I believe you’re saying that you have a function (I’m using that term in a generic sense) that you start at system boot time, through /etc/init.d/rc.local, and, as a result of running that function, the system presents an interactive shell prompt to the user when it boots. If that’s it, you need to simply exit from the thing you are running from rc.local, and let the system take care of the login dialog. If you’re starting an X session, that means you need to terminate the X session. (Or are you saying that you want a different login dialog from the one the system normally uses?)
Jul
25
reviewed No Action Needed Specifying DNS settings to override those of DHCP
Jul
24
comment Run two commands on one argument (without scripting)
I give up. We're not on the same planet.
Jul
24
comment Run two commands on one argument (without scripting)
Perhaps we're having some fundamental disagreement of the meaning of the word typing.
Jul
24
comment Run two commands on one argument (without scripting)
Strictly speaking, this is not an answer to the question as asked: “How can you execute both commands on the same input (without typing the input … twice)?” (emphasis added). Your answer applies to all files in the current directory – and it includes * twice. You might as well say stat -- *; file -- *.
Jul
24
comment Strange difference between pwd and /bin/pwd
@user3581976: Do you understand what a “builtin command” is? It means that all processing to execute the command is built in to the shell, so it can do it without using an external program. So, in answer to your question “And doesn't the shell use the /bin/pwd command to run pwd?”, the answer is an emphatic No!
Jul
24
answered Strange difference between pwd and /bin/pwd
Jul
23
reviewed No Action Needed Linux replacement to Windows Media Center
Jul
23
reviewed No Action Needed -bash: cd: .ssh/: Permission denied