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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

redirecting

  • 20-08-2007 8:16pm
    #1
    Closed Accounts Posts: 91 ✭✭


    "Obtain a list of users from the /etc/passwd file, sort it and then redirect it to a new file called ‘users’."

    cat passwd | cut -d: -f5 | sort > users


    Ok but i want to redirect it to coursework/chapter5/users

    and i get an error saying no such file or directory.

    anyone any ideas?


Comments

  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    magnia wrote:
    cat passwd

    This is the problem. You're saying "output the contents of the file 'passwd' ". There isn't one in the directory you're in. What you want is:

    cat /etc/passwd

    and redirect to is:

    > coursework/chapter5/users

    at the end (unless you're already in that directory of course).


  • Closed Accounts Posts: 91 ✭✭magnia


    yeah i am in that directory and i want to redirect to the coursework directory but cant

    im here /etc


  • Registered Users, Registered Users 2 Posts: 304 ✭✭PhantomBeaker


    So when you do
    cat passwd | cut -d: -f5 | sort > coursework/chapter5/users
    

    if you're in /etc, you're redirecting to /etc/coursework/chapter5/users - and I'm assuming /etc/coursework or /etc/coursework/chapter5 doesn't exist.

    The problem is, you're using relative paths - they depend on the directory you're sitting in. Try using absolute ones (ones that will get you to the same place regardless of the directory you're currently in).

    Hint: these pathnames start with /

    Aoife


Advertisement