User avatar
ric96
Posts: 1253
Joined: Sun Mar 17, 2013 6:03 am
Location: NOIDA, India
Contact: Website

power of sudo !!!

Sat Mar 29, 2014 1:10 pm

Image
:D :D
My apologies for shameless YouTube Plugs...
youtube.com/sahajsarup
twitter @sahajsarup
skype srics1996
e-mail: sahajsarup@gmail.com
Blog: http://www.geektillithertz.com/wordpress
Web: http://www.geektillithertz.com

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: power of sudo !!!

Sat Mar 29, 2014 1:34 pm

Very good! :D
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: power of sudo !!!

Sat Mar 29, 2014 1:53 pm

lol.

but actually the actual command given was sudo "do nothing !!" , so its quite reasonable to agree with that. :roll:

a sudo "make me a sandwich" could result in a different response! :P

User avatar
jojopi
Posts: 3270
Joined: Tue Oct 11, 2011 8:38 pm

Re: power of sudo !!!

Sat Mar 29, 2014 2:19 pm

mahjongg wrote:the actual command given was sudo "do nothing !!"
"!!" is a history expansion of the previous command (in bash and csh). It is not always valid to prefix sudo textually to the previous command, but it does work in this case:

Code: Select all

pi@tau ~ $ make me a sandwich
what? make it yourself
pi@tau ~ $ sudo !!
sudo make me a sandwich
okay
pi@tau ~ $ cat Makefile 
me a:
        @:

sandwich:
        @test "`id -u`" -eq 0 && echo "okay" || echo "what? make it yourself"

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: power of sudo !!!

Sat Mar 29, 2014 2:33 pm

ah, i was wondering if the !! had any special meaning!

you learn something every day. :mrgreen:

I wonder of the maker of the cartoon was aware of it?
Although it resembles it, Its not an actual xkcd drawing is it?

if it is then I guess the "double bang" is no coincidence!

thanks!

User avatar
scruss
Posts: 3212
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: power of sudo !!!

Sat Mar 29, 2014 2:33 pm

Well played, jojopi!

The linked image is trivial edit of the XKCD original: http://xkcd.com/149/
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6229
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: power of sudo !!!

Sat Mar 29, 2014 3:15 pm

Just for the hell of it, a few semi-related tips:

Code: Select all

shift@Shift-PC ~ $ whoami
shift
shift@Shift-PC ~ $ history
*list of commands you ran before*
507  whoami
508  history
shift@Shift-PC ~ $ !507
whoami
shift
shift@Shift-PC ~ $ !who
whoami
shift
shift@Shift-PC ~ $ sudo !who
sudo whoami
root
shift@Shift-PC ~ $ !who --version
whoami --version
whoami (GNU coreutils) 8.21
Packaged by Gentoo (8.21 (p1.0))
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
This is handy if you forgot some long command you typed. You can use history and ! to find and run it again. If you remember the start of it ! can be used to complete the rest of it and you can also run it as root by adding sudo before it. Or, as in the last case, you can use it to add parameters without typing the whole thing out again. If you're using gcc and don't need makefiles yet and you've already ran commands to compile, run and clean your program, you can use !gcc, !./and !rm too.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: power of sudo !!!

Sun Mar 30, 2014 2:08 am

scruss wrote:Well played, jojopi!

The linked image is trivial edit of the XKCD original: http://xkcd.com/149/
ah, never seen that one, but without the double bang ("!!") it is indeed a bit more logical.
which begs the question if the modifier of the cartoon did know that "!!" would expand to the last given command.....

i am guessing that its still simply coincidental....

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: power of sudo !!!

Sun Mar 30, 2014 2:29 am

Nah, that was deliberate. Nice job, too. Nerd humour at it's finest!
note: I may or may not know what I'm talking about...

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: power of sudo !!!

Sun Mar 30, 2014 8:07 am

I do it this way

Code: Select all

login:  root
password: XXXXXXXX
Welcome to the Raspberry Pi

# Do what I command
Yes master.
#
no discussion, mother-may-i, or any other nonsense. It is just done
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: power of sudo !!!

Mon Mar 31, 2014 11:40 pm

lol.

Return to “Off topic discussion”