Archive for the ‘bash’ Category
Posted by jpluimers on 2014/04/29
I needed AntiVir on an openSUSE workstation.
Too bad the default installation package from YaST installed an old license: AntiVir would not work, and I was getting emails like these at regular intervals:
<br />Date: Thu, 25 Apr 2014 08:57:11 +0200<br />From: Cron Daemon <root@....><br />To: root@....<br />Subject: Cron <root@...> /usr/lib/AntiVir/guard/avupdate-guard --product=Scanner > /dev/null<br /><br />Error: No valid license was found<br />
After searching the web for a while, I found a lot of posts with wrong information, basically coming down to these 2:
At the bottom of the post, you will find a small shell script that I use to keep the hbedv.key up-to-date.
First some more about HBEDV, then how I found about the new download location, and a command to show you the current license information. Read the rest of this entry »
Posted in *nix, bash, Development, Linux, openSuSE, Power User, Scripting, Software Development, SuSE Linux, wget | 3 Comments »
Posted by jpluimers on 2014/03/29
Thanks Robert Gamble, ephemient and Jonathan Leffler. Be sure to read the top two answers and comments for full details.
Until now, I always used $* to pass on arguments from *nux shells (bash, sh, ash, etc.). Works on ESXi as well. But that is not the correct way to do.
But “$@” is the correct way:
- Use “$@” to represent all the arguments:
for var in "$@"
do
echo "$var"
done
- As a shortcut,
for var; do ...; done means for var in "$@"; do ...; done
- Basic thesis: “$@” is correct, and $* (unquoted) is almost always wrong. This is because “$@” works fine when arguments contain spaces, and works the same as $* when they don’t. In some circumstances, “$*” is OK too, but “$@” usually (but not always) works in the same places. Unquoted, $@ and $* are equivalent (and almost always wrong).
This next to the following construct makes file processing in *nix a breeze:
for filename in *.7z; do if 7za t $filename 2>&1 > /dev/null; then echo $filename passed; else echo $filename failed; fi; done
–jeroen
via: command line – How to iterate over arguments in bash script – Stack Overflow.
Posted in *nix, bash, Cygwin, Development, ESXi4, ESXi5, ESXi5.1, ESXi5.5, Linux, Power User, Scripting, Software Development, SuSE Linux, VMware ESXi | Leave a Comment »
Posted by jpluimers on 2014/03/25
As a follow up on my recent rsync on ESXi 5.1 post, as – when rsync in ESXi terminates the hard way because of a lost SSH connection – rsync can leave “hidden” files behind.
A small script that recursively shows the hidden files (those starting with a dot) starting from the current directory:
find . -iname ".*"
More of those (including deleting them, filtering for only files or only directories, etc) are at Linux / UNIX: Bash Find And Delete All Hidden Files Directories.
Note: don’t try to outsmart using something like piping through grep "\/\." as that will also match files who’s parent directories are hidden.
–jeroen
via:
Posted in *nix, Apple, bash, Development, ESXi4, ESXi5, ESXi5.1, ESXi5.5, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development, SuSE Linux, VMware, VMware ESXi | Tagged: hidden files, rsync | Leave a Comment »
Posted by jpluimers on 2014/03/07
lesspipe is a great tool:
lesspipe.sh is an input filter for the pager less as described in less‘s man page. The script allows you to view files with binary content, compressed files, archives and files contained in archives.
… however getting it to run on OpenSUSE was a bit of a journey as it is not part of the standard OpenSUSE 12.x repository. You can only get ‘unstable’ lesspipe packages, of which the Show home:adra / lesspipe – openSUSE Build Service seems to be maintained most frequently.
This is how to install it from there: Read the rest of this entry »
Posted in *nix, bash, Development, Linux, openSuSE, Power User, Scripting, Software Development, SuSE Linux | 2 Comments »
Posted by jpluimers on 2013/05/10
Finder on your Mac by default does not show hidden files, and the console has vi, which lots of people find awkward to use.
There is an easy trick to open a hidden file like ~/.bash_profile (for instance to add an alias) with a visual text editor.
Just execute this in your terminal:
- Always with TextEdit
open -e ~/.bash_profile
- For the default text editor (usually TextEdit)
open -t ~/.bash_profile
- For a specific text editor (in this cast TextWrangler)
open -b com.barebones.textwrangler ~/.bash_profile
The man open(1) page has more information on the parameters you can pass to open.
–jeroen
PS: You can teach Finder to Quickly show and hide hidden files | Finder, Terminal | Mac OS X Tips.
Posted in Apple, bash, Development, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook-Air, MacBook-Pro, OS X 10.8 Mountain Lion, Power User, Scripting, Software Development | 6 Comments »