2009-03-31
Link collection 2009/03
Well, I normally despise of thinks like this link collection, but I thought I might add it anyway, since these are useful links for me and if I don’t post them here, I’m likely to forget where to find them in the near future:
- Sean Finney has a nice post about storing the list of parameters a (shell) script got in a way that it can be restored later. Quite handy if your script walks through the arguments parsing them (and consuming them while doing so) but you want to be able to display them in a helpful way if the parsing fails at some point.
- A while ago, Ingo Jürgensmann had a post that helps retrieving files from lost+found after a filesystem check, provided that you run his helper script on a regular basis. The same approach can also be used if you have a backup of all files, but lost the sorting work you did after the backup was done. This is possible because running the script can be done more often then you would normally do backups.
- He also has a small post about mtr oddities when IPv6 comes into play
- Adeodato Simó wrote about databases and when timestamps that store the timezone information really are more useful then timestamps that don’t.
- Adeodato also has a short post on using ssh as a socks proxy, which can be quite handy if you are behind a firewall.
Update: Fixed link to Ingo’s file retrieval from lost+found article. Thanks to Patrick Schoenfeld who pointed me at the wrong link.
Also thanks to the anonymous poster who found an alternative way to store and (in a way) restore commandline parameters. The solution doesn’t work in an as general way as that by Sean Finney et al., but it is much shorter and therefore interesting for where it can be used (when you control how commandline parameters are processed). See comments on this post for details.
See also Link collection 2009/05/18
See also Another link collection 2009-06-22
See also Dual boot and full encryption – Part 2
Permalink

Cuetzpallin said,
March 31, 2009 at 15:05 UTC (+0000)
Nice and useful links, thanks for your share
Anonymous said,
March 31, 2009 at 16:13 UTC (+0000)
Regarding the approach to saving and restoring parameters, a much easier solution (which hopefully won’t get mangled in this comment):
echo Original $# arguments: “$@”
echo Processing arguments one at a time…
n=$#
set “$@” “$@”
while [ "$#" -gt "$n" ]; do
echo Processing argument “$1″
shift
done
echo Back to the original $# arguments: “$@”
Anonymous said,
March 31, 2009 at 16:16 UTC (+0000)
OK, the indentation got eaten, but otherwise that came through fine. Anyway, the above approach works with any whitespace or strange symbols you want to put into the parameters, without having to escape them.
Patrick said,
March 31, 2009 at 19:33 UTC (+0000)
Hi,
the link to the lost+found article is broken. It also points to Seans blog entry.
Regards,
Patrick
sven said,
March 31, 2009 at 19:53 UTC (+0000)
Yep, indentation was eaten. Anyway, your approach works fine as long as you have control over how the commandline arguments are processed. But at times you just want to leave the pre-existing commandline parsing alone or even use some sort of library function for this. In that case, your approach won’t work. But it is a really nice idea for own scripts that are fully under ones control. Thanks for sharing the idea.