Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # ./fstring.sh
- # factor string and fold factored output
- # Israel Torres
- # Wed Feb 8 07:34:42 PST 2012
- #
- rqdapp='factor'
- hash $rqdapp 2>&- || { echo >&2 "$rqdapp binary not found - aborting"; exit 1; }
- #
- if [ ! $# -lt 1 ]; then
- fme=$(echo -n $1 | wc -c)
- fct=$($rqdapp $fme)
- echo -e "LENGTH:"$fme
- echo -e "FACTOR:\t$fct"
- for i in ${fct}; do
- fout=$(echo $1 | fold -$i)
- echo -en "#$i#\t"
- for x in {1..72}; do
- echo -n "#"
- done
- echo -e "$fout\n"
- done
- else
- echo "usage: $0 'string'"
- echo "example: $0 string"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement