[aur-general] Is it OK to submit a package that is a dozen of one-line scripts?

Johannes Altmanninger aclopte at gmail.com
Sun Oct 19 14:31:46 UTC 2014


Nowaker <enwukaer at gmail.com> writes:

> I would like these oneliners as long as they have sensible names, e.g.
> octal2hex instead of o2x.

For interactive use it would probably be the best to provide the
functions in one file and source it in your shell. This way it is much
easier to modify than all those files. This bash snippet should roughly do the same:

#!/bin/bash

declare -A base

base[b]=2
base[o]=8
base[d]=10
base[h]=16

for i in "${!base[@]}"
do
    for o in "${!base[@]}"
    do
        source <(echo \
          "function ${i}2${o} { \
           echo "obase=${base[$o]};ibase=${base[$i]}; \$@\" | bc; }"\
        )
    done
done


More information about the aur-general mailing list