20,646 reputation
34577
bio website
location United States
age
visits member for 3 years, 3 months
seen 8 hours ago

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


Jul
12
revised Iterate over n files?
added 20 characters in body
Jul
12
comment How to do nothing forever in an elegant way?
I like the tail -f /dev/null approach the best and find it elegant enough as well, since the command usage matches the intended purpose quite closely.
Jul
12
comment Iterate over n files?
Yes, it looks like the file names are relatively benign (hence no downvote). However the OP hasn't really specified what they look like beyond *.svg (which is why I posted a comment on the question asking). In the most general case where you need to handle all file names, you'd have to resort to shell globbing and arrays or find -print0 | xargs -0 constructs. See my answer for an example of the former.
Jul
12
answered Iterate over n files?
Jul
12
revised How can I cd to the previous/next sibling directory?
added 1 characters in body
Jul
12
comment How to repeat currently typed in parameter on bash console?
@k0pernikus Yes on most keyboards, the Alt key is the Meta key.
Jul
12
revised How does a shell (bash, for example) expand wildcard patterns?
added 193 characters in body
Jul
12
comment Iterate over n files?
If you are going to recommend using ls in a pipe to parse its output, you should also warn about the many dangers of doing so prominently, and at the beginning to make sure people see it.
Jul
12
comment Iterate over n files?
Are your files all named DSC0100.JPG.svg ... DSC2600.JPG.svg?
Jul
11
comment Are there naming conventions for variables in shell scripts?
@GarrettHall That's entirely up to you. Once you pick one stick with it. Consistency is more important than the actual choice.
Jul
11
comment Are there naming conventions for variables in shell scripts?
The only one that I know of which everyone should follow is all uppercase names should be reserved for the shell. Don't use them to avoid accidentally clobbering something important like PATH or HOME or anything else the shell might reserve in the future.
Jul
10
comment Run a script automatically as I switch to a directory
It should be mentioned that this particular implementation does open up a serious security hole. Never cd to any directory other users can drop files into (like a dropbox or Public directory, e.g. rm -f ~you/Public/set_foo_env.sh; echo $'#!/bin/sh\nchmod -R 777 ~' > ~you/Public/set_foo_env.sh).
Jul
10
revised Run a script automatically as I switch to a directory
added 2 characters in body
Jul
10
comment Check if the command exists in bash
@Sachin You'll have to define more specifically what you consider invalid (or what you want to exclude). Would a script placed in /usr/bin by root be considered a user script? What about a binary installed into /usr/local/bin? Would command -p/setting PATH to some default value suffice?
Jul
9
comment Check if the command exists in bash
The set of bash built-ins is fixed, finite, and documented. Why do you need runtime checks? You could just test for bash version with something like BASH_VERSION or BASH_VERSINFO.
Jul
7
comment Does redirecting output to a file apply a lock on the file?
I don't know of any system that would lock the file by default. What is more likely is the two programs would end up interleaving their writes, since both would be in append mode. The results would be rather unpredictable. Instead of "hello world" you could get "hweolrllod".
Jul
7
comment How do I escape a dot character for an rsync command?
What? Take a look at your command again. It says ssh ... -e. Where is the rsync?
Jul
7
comment GNU/Linux distribution for network virus || malware identification
Backtrack perhaps? It's a live CD distro designed for pen-testing but it probably has detection tools as well. Also, you may be interested in the Snort software suite.
Jul
7
revised Raspberry Pi Wireless USB stick
added 11 characters in body; edited tags
Jul
6
comment How do I remove certain lines (using line numbers) in a file?
Keep in mind the temporary file "in-place" method of sed usually does not work correctly with links of any sort. You may end up overwriting the link with an edited copy of the file, leaving the original in place.