Hot answers tagged

3

GNU tar's --index-file option works well: tar cvf - ./foo 2>foo.err --index-file=foo.out | squish > foo.tar.S


1

Use the shell's command expansion $(...) to switch the output file name. This code checks only for aix. The default behavior updates the .bashrc. echo "alias d='du -sm -- * 2>/dev/null | sort -nr | head -20'" >> $( case $(uname) in *[aA][iI][xX]*) echo ~/.kshrc;; *) echo ~/.bashrc;; esac ) Or, split lines for readability: rcfile=$( case ...


1

OSTYPE="`uname`" OSTYPE="${OSTYPE,,}" case "$OSTYPE" in *aix*) target=~/.kshrc ;; *linux*) target=~/.bash_profile ;; esac if [ -n "$target" ]; then echo "alias d='du -sm -- * 2>/dev/null | sort -nr | head -20'" >> "$target" fi



Only top voted, non community-wiki answers of a minimum length are eligible