Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

2007/06/03

shell: expresiones aritmeticas

Hay dos posibilidades, utilizar el operador aritmetico $(()):


    i=1
    i=$(($i+1))
    echo $i


o bien el comando shell 'expr':


    i=1
    i=`expr $i + 1`
    echo $i


AH

noclobber / shell options / overwrite files


    set -o noclobber
    set -C (es equivalente al anterior)


overwrite: NOT ALLOWED

    % set -C
    % ll > 1
    bash: 1: cannot overwrite existing file
    % set | grep SHELLOPTS
    SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:moni


overwrite: ALLOWED

    % set +C
    % ll > 1
    %
    % set | grep SHELLOPTS
    SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:moni