[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SAGE] tmtowtdi [was: Evil Interview Questions]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
co = Cat Okita
dh = Doug Hughes
pb = Philip Brown
co> A recently nicely evil question that I ran into - program 'hello world'
co> in three languages[0].
dh> does sh, ksh and csh count? ;)
dh>
pb> only if you can do it in three different ways in those languages :-)
pb> #!/bin/csh
pb> echo "hello world"
pb>
pb> #!/bin/ksh
pb> print "hello world"
pb>
pb> #!/bin/sh
pb> cat <<EOF
pb> hello world
pb> EOF
#!/bin/bash
printf "%c%c%c%c%c%c%c%c%c%c%c\n" h e l l o \ w o r l d
#!/bin/zsh
set hello world
echo $*
#!/bin/ash
are () { echo -n e ; } ; droids () { echo -n o ; } ; _for () { echo ld ; }
looking () { echo -n wor ; } ; not () { echo -n l ; } ;
the () { echo -n l ; } ; these () { echo -n h ; } ; you_re () { echo -n \ ; };
: : : : : : : :
these; are; not; the; droids; you_re; looking; _for
: : : : : : : :
#!/bin/tcsh
set tmp=` mktemp -d XXXXXX ` && cd $tmp
touch world
touch hello
ls
# sash under linux, not irix :-)
$ sash -c 'it="for i in hello\\ world; do echo -n \$i; done; echo"; eval $it'
#!/bin/sh
A=o;E=l;S=d;V=r;W=w;b=h;h=o;i=e;n=l;s=l;
echo $b$i$n$s$h $W$A$V$E$S
#!/bin/sh
mknod pee p && echo hello world > pee &
cat pee
#!/bin/sh
( cp /dev/null nohup.out; nohup echo hello world & cat nohup.out ) \
| fgrep -v appending
$ cat /proc/hello
What? Your distribution didn't come with /proc/hello ?! :-D
David
- --
Live in a world of your own, but always welcome visitors.
***
Come to sig-beer-west! http://www.extasia.org/sig-beer-west/
Unix sysadmin available: http://www.extasia.org/resume/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE+Z6/HPh0M9c/OpdARAq6XAJ9g67GPkyljVC3DKKXqE4nu25HS5wCfQawn
W8jWyNjLLaFSWMm9oy2Ld+8=
=yy1k
-----END PGP SIGNATURE-----