>
> #! /bin/bash
> length="$1"
> let hex_bytes=($length+1)/2
> echo -n $(dd if=/dev/random bs=$hex_bytes count=1 2> /dev/null \
> | od --address-radix=none --format=x \
> | tr -d ' \n' \
> | cut -b 1-$length)
>
> But the data never appears! The echo is executed (so says "set -x"). If
> I add an echo after it, the buffer is flushed, but that defeats the point
> of using "echo -n". What's wrong with this script? Thanks.
Try this syntax instead:
let hex_bytes=$[ (${length}+1)/2 ]
-- * The Digital Hermit http://www.digitalhermit.com * Unix and Linux Solutions kwan@digitalhermit.com ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:12:32 EDT