Results 1 to 5 of 5

Thread: [SOLVED] Shell Script variable error.

  1. #1
    Join Date
    Nov 2006
    Location
    India
    Beans
    814

    [SOLVED] Shell Script variable error.

    Hi , I just wrote this shell script ( with help from SO MANY sites).

    Code:
    varx = $(ps ux | awk '/vlc/ && !/awk/ {print $2}')
    echo $varx
    i havent included the #!/bin/sh line on top and when i try to run this file from the terminal :

    # ./vlc.sh

    I get the Following output :
    Code:
    ./vlc.sh: line 1: varx: command not found
    What am i doing wrong ? Please help me , Im out of my mind
    The truth is always beautiful, no matter how ugly it might seem at first.

  2. #2
    Join Date
    Sep 2006
    Beans
    2,914

    Re: Shell Script variable error.

    put #!/bin/bash on the first line
    When declaring variables, no spaces
    Code:
    varx=$(ps ux | awk '/vlc/ && !/awk/ {print $2}')

  3. #3
    Join Date
    Nov 2006
    Location
    India
    Beans
    814

    Re: Shell Script variable error.

    Thankyou
    The truth is always beautiful, no matter how ugly it might seem at first.

  4. #4
    Join Date
    Jul 2008
    Location
    St Louis, MO, USA
    Beans
    150
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Shell Script variable error.

    Do add the [SOLVED] to your thread if you have recieved a satisfactory solution by going into Thread Tools.

  5. #5
    Join Date
    Nov 2006
    Location
    India
    Beans
    814

    Re: Shell Script variable error.

    Haha , Yeah , I almost forgot . Thanks for the heads up
    The truth is always beautiful, no matter how ugly it might seem at first.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •