char2number() in Shell

From: Carl Ma (carl_ma_at_scotiacapital.com)
Date: 05/09/03

  • Next message: Carl Ma: "Summary: char2number() in Shell"
    Date: Fri, 9 May 2003 17:29:51 -0400 (EDT)
    To: sunmanagers@sunmanagers.org
    
    

    Hello,

    I am using the case to convert Monday,Tuesday..Friday to number 1,2,3,4,5 like:

    A=date +%a
    B=0

    case "$A" in

    Mon) B=1;;
    Tue) B=2;;
    Wed) B=3;;
    Thu) B=4;;
    Fri) B=5;;
    *) echo "can only run during Mon - Fri"

    esac

    Is there built-in functions in shell,which can make the script neat?

    thanks & have a good weekend,

    carl
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: Carl Ma: "Summary: char2number() in Shell"

    Relevant Pages

    • shell killer app
      ... Point of sale software for small businesses. ... I'm working on a Bash script ...
      (comp.unix.shell)
    • Re: Help with dbstart script
      ... dbstart.sh.pp Copyr 1991 Oracle ... Use the correct dbstart script, ...
      (comp.databases.oracle.server)
    • Re: nl command
      ... I see sed working with a passed parameter, but I am correct to assume that sed does not work with "read". ... In my script below sed, works with the command line action but not the function. ... echo "What number you like to delete?"; ...
      (comp.unix.shell)
    • Re: Script error
      ... Can You tell me why this script works fine in Solaris10, ... echo "Entre com os sabados, domingos e feriados a serem excluidos - ...
      (comp.unix.shell)
    • Re: nl command
      ... I see sed working with a passed parameter, but I am correct to assume that sed does not work with "read". ... In my script below sed, works with the command line action but not the function. ... echo "What number you like to delete?"; ...
      (comp.unix.shell)