Really fun, kind of trains you to when the situation happens IRL, whether you're thinking about how to escape a shell or if you really did it by mistake.
I love showing this screenshot to people: https://imgur.com/a/ziHqJxB. I was having problems trying to create a jailed shell, so I decided to bind mount /bin. That of course was a bad idea. I gave up and rm -rf'd the mountpoint without unmounting it. The screenshot has the serial logs from after that :P.
Hello HN: This is a a modification to an old side-project that explores what is possible when you are left with a shell and no utilities on a Linux machine.
It's not really that educational tbh. I am not a bash guru, nor do I wish to be one, so the second question left me cold with no desire to proceed any further.
It's a fun game for those with the skills, but an instructional tool it is not.
Given a set of operations, can you get to state X?
Usually requires a lot of searching and/or expertise, however the solutions will break pretty easily depending on which shell you're using, etc. So doesn't really teach you anything aside from iterating over a set of all possible operation combinations.
It's also a variation of the classic tech thought experiment/game 'If you only had X and how would you do Y?'. Like 'If all you had was telnet and had to send an email how would you do it?' or some variation of it, was a common one.
Thanks! It looks like this is adding leading spaces on every line after the first one. The solutions can be viewed https://oops.cmdchallenge.com/#/oops_print_file_contents by clicking on "view solutions" if you want to compare.
For the ^W thing I'm not sure if it's possible to avoid it, I'll check it out.
Very cool! I was a bit confused with the marking criteria. For example, my solution for "list all files on one line" appears to work correctly but is said to be incorrect.
shopt -s dotglob; for i in *; do echo -n "$i "; done
EDIT: I now see that the correct answer is simply "`echo *`". Despite having a dotfile in the directory, it should not be shown.
Maybe I'm missing something obvious here but on the one that asks you to get the proc's cmdline, how do the examples know it's pid 42?
Only way I can see to do this would be to echo /proc/* first to see what PID it is, guess it's 42, then go from there, but that violates the "do it in one command" rule at the beginning.
I do understand that this is meant to be a challenge but if this ever happened to me I'd just boot the archlinux iso and run pacstrap to reinstall pacman and then just reinstall all packages.
I love showing this screenshot to people: https://imgur.com/a/ziHqJxB. I was having problems trying to create a jailed shell, so I decided to bind mount /bin. That of course was a bad idea. I gave up and rm -rf'd the mountpoint without unmounting it. The screenshot has the serial logs from after that :P.
I had a good time enjoying my stupidity.