Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×

Comment Re:None, I have given up bash scripting - mostly (Score 1) 411

For anything complex I tend to use a real programming language, just to avoid the script problems with strange characters in file names.

Personally I favor avoid shell scripts unless I totally control the incoming (file) name arguments scripts see. Using scripts where users provide input has proven deadly too many times as spaces are just mild annoying problems compared when ', $, ", and other fun characters shells treat as metacharacters, even within double quotes, are in file names.

for i in *.txt; do
ugly and certain bug if really sufficiently evil chars are in file names
done

My rules for safe shell follow:

  1. Always enclose variables in double quotes (doesn't work on some specials).
    Corollary: understand the difference between "$*" and "$@".
  2. When you can, always use options to end file names in "\0" rather than end-of-line.
    Corollary: always write any real programs that accept or spit file names to support -0 options of some form.
  3. Always allow scripts to be driven by other scripts. 100 % keyboard input is not good beyond throwaway scripts.
  4. Use find to get file names rather than "*" or "?" wild cards.
  5. KISS: if it's easier to write in another language, than use that language if at all possible. I would rather customers and users be safe than shelled.

A few straight jazz notes:

  1. case "$in_point" in
    xyx*?) echo "You can actually use file name wild cards here";;
    esac
  2. function die () { echo 2>&1 "DIE: $*"; exit 1; } #Easy way to quit with message
  3. Command || die "Oops: already nominated by someone else, but let me add die"
  4. First && Second && echo "Chain commands to stop" || die "Any failure dies" trap ERR "x = $?; echo 'BYE BYE'; exit $x"; #aggressively find errors & keep $?
    (Not neat visual jazz, but anything that helps me find problems quicker is music to my ears, but don't use things like above "die" within trap).
Communications

The State of UK Broadband — Not So Fast 279

Barence writes "The deplorable speed of British broadband connections has been revealed in the latest figures from the Office of National Statistics, which show that 42.3% of broadband connections are slower than 2Mb/sec. More worryingly, the ONS statistics are based on the connection's headline speed, not actual throughput, which means that many more British broadband connections are effectively below the 2Mb/sec barrier. Better still, a separate report issued yesterday by Ofcom revealed that the majority of broadband users had no idea about the speed of their connection anyway."

Comment Re:No Script (Score 1) 450

Back in the bad old days when the 56KB shaping you are dropped down to was the top end, I did indeed use Lynx. But from a shell account at my ISP (surely at a university there's a Linux system you can log onto with ssh). Therefore the download to my system was only the opening screen... the remainder of the download went to my ISP host, which was high speed and at no charge. For most pages the first or second screen was enough to reject pages that were not going to do me any good.

I still sometimes use this trick to this day for other reasons. But I have to admit more and more pages are not friendly to anything but browsers with Javas and Flash enabled. And Web 2 stuff requires it. But,

May I put a plug in for the Viewable With Any Browser Campaign at http://www.anybrowser.org/campaign/ as I believed in that before I found the campaign.

And if you don't need fancy graphics or fonts in your E-mail, there is pine/alpine text based e-mail agents. Again, less hit on your bandwidth if you run them from a shell account.

Slashdot Top Deals

Software production is assumed to be a line function, but it is run like a staff function. -- Paul Licker

Working...