Results 1 to 4 of 4

Thread: Unix Basic Scripts

  1. #1
    Geek_Guest
    Guest

    Unix Basic Scripts

    Whats the difference between ll and ls command?
    Where can i get the set of commands in UNIX?
    What is a shell?
    If i am working on UNIX, What do i need to know?
    Can you tell me some basic scripts in unix?
    I know its long but urgent..

    Question asked by visitor sameer


  2. #2
    Junior Member
    Join Date
    Sep 2007
    Answers
    10

    Re: Unix Basic Scripts

    there is no command called as ll.
    ls displays the files in current directory.
    if you want set of commands in unix then press tab twice in the terminal.
    for in detail about a particular command you can use man command


  3. #3
    Junior Member
    Join Date
    Dec 2007
    Answers
    3

    Re: Unix Basic Scripts

    Hi,

    You may refer to unixguide.net for basics of UNIX.

    Here is an example of shell script which will show you disk space.

    #!/bin/ksh


    init()
    {

    day=`date |tr -s " " "-"|tr -s ":" "."`
    lpat=/home/cmabct/vinod
    mach=`uname -s`
    myn=`uname -n`
    mailp=/usr/sbin/sendmail
    ids=${lpat}/dsk_ids.txt

    logs=${lpat}/LOGS/dsk_${day}.txt
    limit=${lpat}/LOGS/tmp_dsk.txt

    ##############################
    #


    sub="Subject: Disk Space Status($myn) on $day"
    header="Filesystem kbytes used avail %used Mounted on"


    if [ ! -d ${lpat}/LOGS ]
    then
    mkdir -p ${lpat}/LOGS
    fi
    if [ ! -f $ids ]
    then
    return 1
    fi

    >$logs
    >$limit
    }

    cmds()
    {
    case $mach in
    HP-UX) bdf | egrep "9[0-9]%|100%" > $limit;;
    SunOS) df -lkF ufs > $logs
    df -lkF tmpfs >> $logs
    cat $logs | egrep "9[0-9]%|100%" > $limit
    mailp=/usr/lib/sendmail;;
    Linux) df -h | egrep "9[0-9]%|100%" > $limit;;
    *) rm $logs $limit
    return 1
    esac
    }

    creatfile()
    {
    if [ -s $limit ]
    then
    > $logs
    cat $ids >$logs
    echo "$sub\n\n">>$logs
    echo "$header">>$logs
    cat $limit >>$logs
    sleep 1
    $mailp -t < $logs
    else
    rm $logs $limit
    return 1
    fi
    }


    mast()
    {
    init
    if [ $? -ne 1 ]
    then
    cmds
    fi

    if [ $? -ne 1 ]
    then
    creatfile
    fi
    if [ $? -ne 1 ]
    then
    rm $limit
    fi
    }



    Thanks,
    Amit Shiknis


  4. #4
    Junior Member
    Join Date
    Dec 2007
    Answers
    3

    Re: Unix Basic Scripts

    Hi,

    You may refer to unixguide.net for basics of UNIX.

    Here is an example of shell script which will show you disk space.

    #!/bin/ksh


    init()
    {

    day=`date |tr -s " " "-"|tr -s ":" "."`
    lpat=/home/test/test
    mach=`uname -s`
    myn=`uname -n`
    mailp=/usr/sbin/sendmail
    ids=${lpat}/dsk_ids.txt

    logs=${lpat}/LOGS/dsk_${day}.txt
    limit=${lpat}/LOGS/tmp_dsk.txt

    ##############################
    #


    sub="Subject: Disk Space Status($myn) on $day"
    header="Filesystem kbytes used avail %used Mounted on"


    if [ ! -d ${lpat}/LOGS ]
    then
    mkdir -p ${lpat}/LOGS
    fi
    if [ ! -f $ids ]
    then
    return 1
    fi

    >$logs
    >$limit
    }

    cmds()
    {
    case $mach in
    HP-UX) bdf | egrep "9[0-9]%|100%" > $limit;;
    SunOS) df -lkF ufs > $logs
    df -lkF tmpfs >> $logs
    cat $logs | egrep "9[0-9]%|100%" > $limit
    mailp=/usr/lib/sendmail;;
    Linux) df -h | egrep "9[0-9]%|100%" > $limit;;
    *) rm $logs $limit
    return 1
    esac
    }

    creatfile()
    {
    if [ -s $limit ]
    then
    > $logs
    cat $ids >$logs
    echo "$sub\n\n">>$logs
    echo "$header">>$logs
    cat $limit >>$logs
    sleep 1
    $mailp -t < $logs
    else
    rm $logs $limit
    return 1
    fi
    }


    mast()
    {
    init
    if [ $? -ne 1 ]
    then
    cmds
    fi

    if [ $? -ne 1 ]
    then
    creatfile
    fi
    if [ $? -ne 1 ]
    then
    rm $limit
    fi
    }
    mast


    Thanks,
    Amit Shiknis


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact