shellsupport(1)
shellsupport(1) supports (bourne) shell scripting. It is a commandline C program that provides those features I miss when writing portable shell scripts, because they are not covered by other portable (Posix 1003.2) tools.
At this time, these are (more suggestions welcome!):
- Date and time handling, including format conversion (ISO-8601, date(1), seconds since 1970, apache-logfile). The seconds format allows you to do arithmetic like "increment by 2 days" and then convert it back to readable formats.
- counting integers, including optional leading zeros to pad all numbers to the same length.
- file access times.
- echoing the content of a symlink (not its target). Useful when using symlink not as links but as fast config files (one system call to get contents, not open/read/close).
- random numbers with ranges, float or int.
- echoing arguments in random order.
Short usage instructions:
Usage: -t s print seconds since 1970 for current time -t s <datespec> print seconds since 1970 for <datespec> supported formats (only C locale, no national locales!): date(1) Tue May 16 17:10:19 MEST 2000 apache-log 16/May/2000:17:07:01 ISO-8601 short 20000516T151152 Random U.S. crap 02-21-1999 02:31 PM (month first, 12h) -t d <seconds> print date(1)-format for 1970+sec -t a <seconds> print apache-format for 1970+sec -t i <seconds> print ISO-8601 short for 1970+sec -t u <seconds> print Unix-like CCYYMMDDhhmm.SS for 1970+sec -t r <seconds> print 20040325 20:20 (works for PHP strtotime) -f a <file> file access date in secs from 1970 -f c <file> file status date in secs from 1970 -f m <file> file modification date in secs from 1970 -f l <symlink> print target of symbolic link -f P <file> <blocksz> Pad file to blocksize with zeros -f s <file> <size> Create a sparse zeroed file of size <size> -f w <file> wipeout (overwrite with zeros) -c count from 1 -c <n> count from 1 to <n> -c <n> <m> count from <n> to <m> if <n> has a leading zero, all number will have zeros in front so that the length of each number is that of <m> (not <n>) -c <n> <m> <o> dito, with step <o> (may be negative) -r i random integer between 0 and 2147483647 -r i <n> random integer number between 0 and <n> -r f random float between 0.0 and 1.0 -r f <f> random float between 0.0 and <f> -r a <arguments ...> echo arguments in random order -r a as before, but use * (without dirs) -e e <command> run command and do a full report on the exit status we get (WIFSIGNALED etc)