linux script


Results 1 to 3 of 3

Thread: linux script

  1. #1
    Join Date
    Jan 2010
    Posts
    16

    linux script

    #!/bin/ksh

    user1=`who am i|awk '{ print $1 }'`
    echo $user1

    ==================
    above is my script
    This works from prompt
    however it does not work from cron

    please help

  2. #2
    Join Date
    Jan 2010
    Posts
    16
    Quote Originally Posted by rjnlinux View Post
    #!/bin/ksh

    user1=`who am i|awk '{ print $1 }'`
    echo $user1

    ==================
    above is my script
    This works from prompt
    however it does not work from cron

    please help
    the solution is as follows

    create a file which has variables I require
    source this file in the script

    Now the script works from cron as required
    Enjoy !!

  3. #3
    Join Date
    Jun 2014
    Posts
    1
    You can also implement this by placing the variables in the function, it will give you an opportunity to bring them anywhere.

Posting Permissions

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









×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.