| bio | website | |
|---|---|---|
| location | Eastern, NY | |
| age | ||
| visits | member for | 1 year, 8 months |
| seen | 23 hours ago | |
| stats | profile views | 23 |
Long time Linux user (currently kubuntu). Use Windows 98, XP, and 7 when I have to. Programmed in many languages, currently using bash and awk for most things.
Have one project on sourceforge:
Duplex printing emulator for non-duplex printers (Linux) http://sourceforge.net/projects/duplexpr/
|
Jul 27 |
comment |
File is mysteriously empty. Options to recover? @Tim I tried areca about a year ago. It was lovely in theory, but when I ran into problems, there was very little support on the forum and I gave up. Is the user community more lively now? |
|
Jul 14 |
comment |
Make `rm` move to trash Do whatever you want such as the solutions outlined in the answers below, but don't name it rm. As pointed out by others, renaming/repurposing standard commands leaves you vulnerable when you habitually try to use them on other systems, but it also will cause problems for anyone else (perhaps assisting you) using your system/account when unexpected results occur. |
|
Jul 14 |
comment |
Can I restrict a user to use special programs? I'm not adding this as an answer because I haven't tried it in a long time, but you can change the user's login shell (in /etc/passwd, I believe) to run an arbitrary command or script instead of the default that allows them full normal user access. You just have to test your command/script to make sure the user can't break out of it. |
|
Jun 16 |
comment |
How to do integer & float calculations, in bash or other languages? As a variation on the bc approach, I added the following function (that I found on stackexchange somewhere) to my .bashrc file. I can just enter calc 2+3 and get 5. ## Command line calculator
calc () {
bc -l <<< "$@"
}
|
|
May 25 |
comment |
What's the standard for indentation in shell scripts? +1 for the guide url. It's a good starting point anyway. |
|
May 5 |
comment |
What is a simple way to schedule a single event to happen at some time in the future? +1 for script and for mentioning dzen and notify-send which I had not heard of. |
|
May 5 |
comment |
In what order do piped commands run? And what's cool about this example is that when head gets the one line it needs, it terminates and when grep notices this, it also terminates without doing a bunch of further work for nothing. |
|
Apr 20 |
comment |
Locate enscript reported non-printable chars Found another clue here. The trick is running the files through hexdump first and searching the output. Also found some things about using echo with an unescaped $ to pass raw data into grep. Bottom line, I'm not sure your original grep was correct. stackoverflow.com/questions/4180081/linux-binary-grep unix.com/shell-programming-scripting/… |
|
Apr 20 |
comment |
Locate enscript reported non-printable chars Maybe this will provide a clue as to how to handle these. It is not an answer: unix.stackexchange.com/questions/18579/… |
|
Apr 20 |
comment |
Substituting strings in a very large file Linux allows urls to have embedded multiple slashes in paths, so this code may fail if you have any of those. Testing for the whole string, http and all, won't have this problem. |
|
Mar 29 |
comment |
Adding a user who can only execute scripts remotely If you only want the user to be able to execute the commands from your directory (and there aren't too many), you could take the "prog" out of the read above and use a select statement to offer a text menu of choices of those programs and then do the read for the arguments. I would also test this to make sure what happens if you type a bunch of Ctrl-Cs at various points in the script. You may want a trap command in there too. |
|
Feb 4 |
comment |
Doing simple math on the command line using bash functions: $1 divided by $2 (using bc perhaps) Thanks. I needed a simple calculator like that! |
|
Feb 4 |
comment |
How can I source the bashrc file every time I 'clear' Make sure your .bashrc script has no cumulative effects. If it does anything like appending things to your paths, it could get messy. In general, .bashrc is for initialising your shell environment. if it does other things, then it would be better to split them out into a new script and call that along with clear. Also, if anyone else uses your system or assists you, they may encounter unexpected behaviour because you have repurposed a common command. |
|
Feb 4 |
comment |
Why do we need a firewall if no programs are running on your ports? I'm not sure, but I believe DROP just doesn't respond so the requester doesn't even know if the request was received or if your machine exists. REJECT says you're definitely there and just don't want to talk about it. And, if something's behind a locked door, it might be worth trying to find a way in to find out what's worth protecting. |
|
Jan 14 |
comment |
How to conditionally do something if a command succeeded or failed Oops. You're correct. |
|
Jan 14 |
comment |
How to find application's path from command line? I thought it was going come back with "42"! LOL. |
|
Jan 14 |
comment |
How to conditionally do something if a command succeeded or failed @Keith-Thompson: Your way is a bit simpler and probably faster. I'm just used to coding in other languages and it just doesn't look right to me. |
|
Dec 17 |
comment |
“Bookmarks” for bash +1 for set -P. Some of my symlinks were driving me crazy because I couldn't remember where they really went and didn't remember the command that shows that information. |
|
Dec 11 |
comment |
How do I make multiple directories at once in a directory? One thing to keep in mind is how your file names will be sorted when you list them or use them with wildcards like *. '11' will sort before '2'. This can be avoided if you arrange for all the numbers to be the same length with leading zeros. Dennis Williams shows how to do that in bash 4, but you can code your script to do it if you don't have bash 4. |
|
Dec 9 |
comment |
volcopy for Linux? Last I saw, partimage would only restore to a partition of exactly the same size as the original. So make sure your new partition is the same size and adjust it, if necessary, after the restore. I didn't know about the uuid issue. |