Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help!

Options
  • 16-08-2007 6:31pm
    #1
    Closed Accounts Posts: 91 ✭✭


    can someone tell me if this is right. i have to learn Unix for a job interview and im a tad lost. have to send them scripts by next week so have a week to learn it.

    "Obtain a list of users (found in /home/) and append this to the contents of the 'dir_listing' (remember the '>>' command!)."

    [john.casement1@unix chapter2]$ cd ~

    [john.casement1@unix ~]$ users
    abul.bashar belkacem.berbache diarmuid.kieran hardish.panesar john.casement1 mac aulay.adeji matthew.westwood matthew.westwood olivier.driard osama.ali razaq.kel ani razaq.kelani roger.ledreau yannick.arend

    [john.casement1@unix ~]$ echo users >> coursework/chapter2/dir_listing

    [john.casement1@unix ~]$ cd coursework/chapter2/

    [john.casement1@unix chapter2]$ cat dir_listing
    total 298
    drwxr-xr-x 3 root root 4096 Jul 23 10:44 bin
    drwxr-xr-x 4 root root 1024 Jan 5 2007 boot
    drwxr-xr-x 12 root root 3680 Jul 30 09:37 dev
    drwxr-xr-x 96 root root 12288 Aug 13 15:29 etc
    drwxr-xr-x 5 root root 4096 Jul 30 17:03 fasttrack_materials
    drwxr-xr-x 387 root users 32768 Aug 13 15:26 home
    drwxr-xr-x 2 root root 4096 Jan 24 2007 leeb
    drwxr-xr-x 14 root root 4096 Jan 5 2007 lib
    drwx
    2 root root 16384 Jan 5 2007 lost+found
    drwxr-xr-x 2 root root 4096 Jul 30 09:37 media
    drwxr-xr-x 2 root root 0 Jul 30 09:37 misc
    drwxr-xr-x 4 root root 4096 Jan 30 2007 mnt
    drwxr-xr-x 2 root root 0 Jul 30 09:37 net
    drwxr-xr-x 3 root root 4096 Jan 8 2007 opt
    dr-xr-xr-x 227 root root 0 Jul 30 09:36 proc
    drwxr-x--- 25 root root 4096 Aug 6 10:58 root
    drwxr-xr-x 3 root root 4096 Jan 5 2007 rpms
    drwxr-xr-x 2 root root 12288 Jan 5 2007 sbin
    drwxr-xr-x 2 root root 4096 Jan 5 2007 selinux
    drwxr-xr-x 2 root root 4096 Oct 10 2006 srv
    drwxr-xr-x 2 root root 4096 Jul 23 14:41 student_materials
    drwxr-xr-x 11 root root 0 Jul 30 09:36 sys
    drwxrwxrwx 47 root root 98304 Aug 13 17:46 tmp
    drwxr-xr-x 2 root root 4096 Jul 5 16:32 trainee_materials
    drwxr-xr-x 4 oracle oinstall 4096 Feb 1 2007 u01
    drwxr-xr-x 15 root root 4096 Jan 27 2007 usr
    drwxr-xr-x 2 root root 4096 Jan 27 2007 usrcampus
    drwxr-xr-x 23 root root 4096 Jan 5 2007 var
    users


    SHOULD I BE ABLE TO SEE THE USERS NAMES LIKE THEY ARE SHOWN ABOVE?


Comments

  • Registered Users Posts: 5,238 ✭✭✭humbert


    you don't want the echo there. just users >> coursework/chapter2/dir_listing


  • Closed Accounts Posts: 91 ✭✭magnia


    U Da Man!!!!!!!!!


  • Moderators, Technology & Internet Moderators Posts: 37,485 Mod ✭✭✭✭Khannie


    users found in /home (per the spec) is like this:

    ls /home >> coursework/chapter2/dir_listing

    or

    ls -1 /home etc....


  • Registered Users Posts: 865 ✭✭✭generalmiaow


    agree with Khannie - `users` just has a list of who is logged in. also, if you want to echo the output of a command (which you don't need to do, since the command itself "echos", put the name of the command in backticks (` - not '), like

    echo `users` >> file


Advertisement