create a nicely formatted example of a shell command and its output

example() { echo "EXAMPLE:"; echo; echo " $@"; echo; echo "OUTPUT:"; echo ; eval "$@" | sed 's/^/ /'; }
Shell function which takes a bash command as its input, and displays the following formatted output: EXAMPLE: command OUTPUT: output from command
Sample Output

    example ls -l


        ls -l
        total 0
        -rw-rw-r-- 1 bartonc bartonc 0 Nov 10 13:58 a
        -rw-rw-r-- 1 bartonc bartonc 0 Nov 10 13:58 b
        -rw-rw-r-- 1 bartonc bartonc 0 Nov 10 13:58 c

By: bartonski
2019-11-10 19:08:23

What Others Think

You need to add some color to this.
renich · 95 weeks and 2 days ago
Thank you so much for sharing with us example of shell command and its exact output. I surely share it with whom I serve IT cv writing service at very affordable price.
LaurendeSouza · 73 weeks and 3 days ago
I appreciate an author for providing here best example of shell command and its output. Keep it up! Regards, Ida.
IdaWallace · 71 weeks and 6 days ago
are there any recent updates with hair extensions denver?
looneyhans · 52 weeks and 5 days ago
Looked great afterward. baby photography Thank you so much, amazing job
idasanka · 48 weeks and 1 day ago
private investigator rochester ny I can't believe that this makes sense! Wow! I am in awe
yeoyeo · 46 weeks and 3 days ago
love this soo much! fly
sammm · 43 weeks and 2 days ago
Will try this soon business loans in amarillo
geebranz · 28 weeks and 4 days ago
If you want to learn commands, then you are here at the right place. This website will bring you the best place for Magicard 300 learning the linux commands. The above one is used to create a nicely formatted example of a shell command and its output. I am expecting more such commands from here.
Alyssalauren · 16 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: