how do I use "arch" to determine which processor I am on - Linux

This is a discussion on how do I use "arch" to determine which processor I am on - Linux ; Hi All: I need to write a script file that will allow me to determine which processor architecture I am on before I take action 1 or action 2 the "arch" command under linux (returns "i686" and "ppc") can do ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: how do I use "arch" to determine which processor I am on

  1. how do I use "arch" to determine which processor I am on

    Hi All:


    I need to write a script file that will allow me to determine which
    processor architecture I am on before I take action 1 or action 2

    the "arch" command under linux (returns "i686" and "ppc") can do this
    but how do I evaluate its return/set it up?

    Any pointers to writing bash scripts would be appreciated as well
    Thanks

  2. Re: how do I use "arch" to determine which processor I am on

    On Fri, 13 Jun 2008 20:51:32 GMT, Anubis wrote:
    >
    > the "arch" command under linux (returns "i686" and "ppc") can do this
    > but how do I evaluate its return/set it up?


    One method, store results in a variable an use it in an "if" or "case"
    statement.

    _arch=$(arch)

    if [ "$_arch" - "i686" ] ; then
    true_stuff_cmds_go_here
    else
    false_stuff_cmds_go_here
    fi

    case $_arch in
    i686)
    true_stuff_cmds_go_here
    ;;
    ppc)
    true_stuff_cmds_go_here
    ;;
    *)
    otherwise_stuff_cmds_go_here
    ;;
    esac


    > Any pointers to writing bash scripts would be appreciated as well
    > Thanks


    http://tldp.org/LDP/abs/html/index.html


  3. Re: how do I use "arch" to determine which processor I am on

    Thank you!!!

    Bit Twister wrote:
    > On Fri, 13 Jun 2008 20:51:32 GMT, Anubis wrote:
    >> the "arch" command under linux (returns "i686" and "ppc") can do this
    >> but how do I evaluate its return/set it up?

    >
    > One method, store results in a variable an use it in an "if" or "case"
    > statement.
    >
    > _arch=$(arch)
    >
    > if [ "$_arch" - "i686" ] ; then
    > true_stuff_cmds_go_here
    > else
    > false_stuff_cmds_go_here
    > fi
    >
    > case $_arch in
    > i686)
    > true_stuff_cmds_go_here
    > ;;
    > ppc)
    > true_stuff_cmds_go_here
    > ;;
    > *)
    > otherwise_stuff_cmds_go_here
    > ;;
    > esac
    >
    >
    >> Any pointers to writing bash scripts would be appreciated as well
    >> Thanks

    >
    > http://tldp.org/LDP/abs/html/index.html
    >


+ Reply to Thread