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

The Shell Challenge

Options
  • 08-02-2006 12:31pm
    #1
    Closed Accounts Posts: 97 ✭✭


    ok some of ye might of seen this be4 but for those who haven't it seperates the nubs from the pros

    so here it is:


    CHALLENGE
    Write a shell script that prints current directory and then prints its own code

    RESTRICTIONS
    The solution script can use only variable assignments and the echo command and try and use the least amount of lines possible


Comments

  • Registered Users Posts: 2,593 ✭✭✭tommycahir


    Sounds suspiciously like a college assignment! :eek:


  • Closed Accounts Posts: 97 ✭✭sAid


    : >

    yeah it was....but i just thought it was pretty tough and the answer is cool ....just wanna see if any of the boards ppl can get it .....anyone who got it in my class got a prize :D


  • Registered Users Posts: 2,082 ✭✭✭Tobias Greeshman


    What you mean by printing its own code??


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    prints itself out i assume :P


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    sAid wrote:
    ok some of ye might of seen this be4 but for those who haven't it seperates the nubs from the pros

    seperates them in what way?


  • Advertisement
  • Registered Users Posts: 4,188 ✭✭✭pH


    They're called Quines and to write one from scratch does involve a good understanding of the language 'that sort of brain' :)


  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    EveningEcho () {
    echo -e "$*"
    echo "EveningEcho '$*'"
    }

    EveningEcho 'EveningEcho () {
    echo -e "$*"
    echo "EveningEcho \047$*\047"
    }'

    That prints the file itself. I don't get the print the directory stuff - was this supposed to do that too? (apropos the use of EveningEcho, yes, I'm originally from down there). If you want tee directory list, just add echo * as the first line, and after the first '.


Advertisement