19,567 reputation
34173
bio website
location United States
age
visits member for 3 years, 1 month
seen 16 hours ago

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


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?
May
5
comment Have backticks (i.e. `cmd`) in *sh shells been deprecated?
@mikeserv You should learn the difference between command substitution, subshell, and arithmetic substitution. "(parens) has issues nesting (parens)" means absolutely nothing because (parens) is not a thing. Are you talking about command substitution, arithmetic expansion, or subshells? All of them nest just fine.
May
5
comment Have backticks (i.e. `cmd`) in *sh shells been deprecated?
@mikeserv There are no issues nesting subshells in command substitutions as long as you read and follow the standard carefully. This standard requires that conforming applications always separate the "$(" and '(' with white space when a command substitution starts with a subshell. There, problem solved. The standard says that $((subshell)) parsing is unspecified behavior and varies by implementation, so if you write that and get non-portable behavior, that is your own fault. This seems like a really desperate attempt to "justify" the use of backticks. It's not working.
May
2
comment How to fix 'set -o emacs' in .bashrc not working in ssh shell
ssh starts an interactive login shell. bash does not read .bashrc when started as an interactive login shell.
May
2
comment last time file opened
According to the mount manpage, relatime has nothing to do with daily limits, but only looks at the atime relative to mtime and ctime. If atime is older than mtime or ctime, atime is updated. If atime is newer than both, then it is left alone. The purpose of this is to preserve the relation between atime and mtime / ctime, since some applications use that information, like mutt to see if it has read your mailbox since it was last updated.
Apr
30
comment Have backticks (i.e. `cmd`) in *sh shells been deprecated?
You may want to add the following quote from the POSIX standard rationale: Because of these inconsistent behaviors, the backquoted variety of command substitution is not recommended for new applications that nest command substitutions or attempt to embed complex scripts. While this is not a formal deprecation since the rationale section is informative and not normative, it does suggest that continued use of backticks should be avoided.
Apr
30
comment Path independent shebangs
You use a single file, not two files. The package has one file modify another file. You have a file modifying itself. There is a distinct difference between these two cases. A file that takes input and produces output is fine. An executable file that changes itself as it runs is generally a bad idea. The example you pointed to does not do that.
Apr
30
comment Path independent shebangs
I assume this is the command -v example you were talking about from man sh. That is a normal-looking installer script, and not a self-modifying one. Even self-contained installers only contain pre-modification input, and output their modifications somewhere else. They don't rewrite themselves the way you are recommending.
Apr
30
comment Path independent shebangs
please see man command for a contradictory opinion - not finding one. Can you direct me to the specific section / paragraph you were talking about?
Apr
30
comment Path independent shebangs
The downvote is because self-modifying code is generally considered bad practice. Back in the old days of tiny assembly programs it was a clever way to reduce conditional branches and improve performance, but nowadays the security risks outweigh the advantages. Your approach would not work if the user who ran the script did not have write privileges on the script.
Apr
24
comment What privileges do I have (find out within bourne shell script)
You are using mode 0600 (u=rw) which lacks the execute bit which is required for a directory in order to create files inside it.
Apr
23
comment scp to Local Machine After SSHing
I second the sftp suggestion. However I would also suggest not using really complicated & annoying paths. If they are annoying to type why type them? Name them something easier to type. Finally, I would suggest using single quotes instead of double backslashes because double slashes are harder to read. Instead of ...\\\ \\\&..., you could just do '...\ \&...'. See how much more readable that is?
Apr
18
comment rkhunter /usr/bin/ssh && /usr/sbin/sshd [Warning]
If the ssh and sshd binaries changed by themselves, and you are sure you didn't do it, that seems very suspicious. What kind of server is this?
Apr
18
comment SSH: “Connection closed by remote host” randomly while working on an interactive session
I would contact the server admin, who actually might have a clue, instead of asking for wild speculation.