Sponsored Content
Full Discussion: fun scripts
The Lounge What is on Your Mind? fun scripts Post 302308175 by quirkasaurus on Friday 17th of April 2009 09:57:02 AM
Old 04-17-2009
Quote:
Originally Posted by Ikon
This is an old one.

At a job interview this was a script I had to explain.

Code:
:(){ :|:& };:

During a job interview?! imho -- not a very constructive question...

This thing doesn't parse on my system. But what I'd expect is
nothing, since usually the null command comments out the rest
of the line effectively.

Tried it. It doesn't parse on my system in ksh, csh, sh or bash.

Here's one to try on a terminal that supports colors:

Code:
perl -e 'for(0..2){&x($_=q^44,37:07* %41,31:20#%-%44,37:06 *%  %47,37:20 %-^)};
&x($_=q^44,37:07* %41,31:20#%-^);for(0..2){&x($_=q^%47,37:34 %-%41,31:34#%-^)};
sub x{for(split(/%/)){s/(\d\d),(\d\d):/\033[$1m\033[$2m:/;
s/:(\d\d)(\D*)/$2x$1/e;s/-/\033[0m\n/g;print;}}'

 

7 More Discussions You Might Find Interesting

1. News, Links, Events and Announcements

Fun with FreeBSD

Fun With Automounting on FreeBSD Link: Nice tips for FreeBSD Unix. http://ezine.daemonnews.org/200202/automounting.html (2 Replies)
Discussion started by: killerserv
2 Replies

2. UNIX for Dummies Questions & Answers

fun with tar

ok, i've figured out my problem with distributed, in Solaris GUI if you click on a tar file it will untar it for you, using paramiters I don't know. now, I've got a tar file in / called dnetc-solaris26-x86.tar i want to install it to the "/Veitch" directory how exactly do I use the tar... (17 Replies)
Discussion started by: veitcha
17 Replies

3. UNIX for Advanced & Expert Users

like to have fun in terminal

Hai Friends I have installed FreeBSD in my system... I have installed it to work in text mode don't have the GUI. The default text color is Black background with White Foreground. I want it to be with Black background with Green Foreground. How could i do that. Thanks in advance Collins (4 Replies)
Discussion started by: collins
4 Replies

4. Shell Programming and Scripting

Fun with awk

uggc://ra.jvxvcrqvn.bet/jvxv/EBG13 #!/usr/bin/awk -f BEGIN { for (n=0;n<26;n++) { x=sprintf("%c",n+65); y=sprintf("%c",(n+13)%26+65) r=y; r=tolower(y) } } { b = "" for (n=1; x=substr($0,n,1); n++) b = b ((y=r)?y:x) print b } ... (0 Replies)
Discussion started by: colemar
0 Replies

5. Shell Programming and Scripting

More fun with awk

#!/usr/bin/ksh ls -l $@ | awk ' /^-/ { l = 5*log($5) h = sprintf("%7d %-72s",$5,$8) print "\x1B ls command with histogram of file sizes. The histogram scale is logaritmic, to avoid very short bars for smaller files or very long bars for bigger files. Screenshot: (4 Replies)
Discussion started by: colemar
4 Replies

6. What is on Your Mind?

Fun things to put in comments in scripts?

Approaching the end of my portion of some STIG/DOD compliance automation and I was challenged by a co-worker to include a story in my code. There are blocks of code that need to be kept the way they are for GIT/Gerrit and then compliance, but otherwise I changed out all the comments into a... (2 Replies)
Discussion started by: Vryali
2 Replies

7. War Stories

Following Cables for Fun!

Hi Folks, I came accross this picture taken a number of years ago now, I just thought I'd share it with you guys. We were in the process of removing equipment from the Data Centre and had followed the cable through to this area, where one of the old patch areas had been. When we lifted the... (2 Replies)
Discussion started by: gull04
2 Replies
fg(1)							      General Commands Manual							     fg(1)

NAME
fg - Runs jobs in the foreground SYNOPSIS
fg [job_id...] Note The C shell has a built-in version of the fg command. If you are using the C shell, and want to guarantee that you are using the command described here, you must specify the full path /usr/bin/fg. See the csh(1) reference page for a description of the built-in command. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: fg: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
None OPERANDS
Specifies the job to be run as a foreground job. If no job_id operand is given, the job_id for the job that was most recently suspended, placed in the background or run as a background job is used. The format of job_id is described in the Jobs section of the ksh(1) reference page. DESCRIPTION
If job control is enabled (see the description of set -m in the ksh(1) reference page), the fg utility moves a background job from the cur- rent environment into the foreground. Using fg to place a job into the foreground removes its process ID from the list of those "known in the current shell execution environ- ment"; see the Jobs section of the ksh(1) reference page. RESTRICTIONS
If job control is disabled, the fg utility exits with an error and no job is placed in the foreground. The fg utility does not work as expected when it is operating in its own utility execution environment because that environment has no applicable jobs to manipulate. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. ENVIRONMENT VARIABLES
The following environment variables affect the execution of fg: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale used to affect the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: bg(1), csh(1), jobs(1), kill(1), ksh(1), sh(1p), wait(1) Standards: standards(5) fg(1)
All times are GMT -4. The time now is 11:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy