Shell Scripts

Make Shell Scripts Executable By Default

If you use vim to write shell scripts, you might want to save the “chmod +x” command after saving the script.

By adding the following line to your vimrc file (typically, it’s located at ~/.vimrc), scripts will automatically become executable.

au BufWritePost * if getline(1) =~ “^#!” | if getline(1) =~ “/bin/” | silent !chmod a+x <afile> | endif | endif

(meaning, if the file includes #! with “/bin/” in the path, apply “chmod a+x” on this file).

via shell-fu.

Have fun ;)

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Saturday, September 26th, 2009 Vim No Comments

Go Up As Much Directory Levels As You Need – Easily

This neat and brilliant script by shell-fu allows you to go up as many directory levels as you want.

For example, instead of typing

cd ../../../..

You’ll be able to type the following and get the same functionality:

cd .. 4

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Saturday, March 7th, 2009 Bash 3 Comments

Get Examples for Random Bash Commands

Following my post about a script to query bash commands from shell-fu, here is another script, which queries shell-fu for examples of a random bash command:

The script is not bullet-proof and might fail if the guys at shell-fu decide to change the website’s layout, but it works for now, and this is good

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Saturday, February 28th, 2009 Bash No Comments

Get Examples for Bash Commands in Your Terminal

This one is by the great shell-fu, a website with many bash examples.

The following script is a powerful enhancement for the bash experience, and a great addition to the manpages, it allows you to query shell-fu for examples about almost any bash command you might want to use.

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Thursday, February 26th, 2009 Bash 4 Comments

A Bash Script To Decode TinyURLs

This is a simple bash script, intended to decode tinyurl URLs, i.e. to revret a tinyurl into the original URL.

It’s always a good practice checking where a URL will send you to before actually visiting it.

For the implementation, I the “Preview” service supplied by tinyurl themselves.

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Sunday, February 22nd, 2009 Command Line No Comments

A Bash Script To Watch Live TV Streams

Hi,

In this post I’ll introduce a very simple and basic Bash script, which uses VLC and a plain text file to let you watch Live TV streams of your favorite channels.

First of all, make sure you have VLC installed in your system.

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , , ,

Monday, February 9th, 2009 Command Line 3 Comments

Playing With Youtube Videos in Linux

In this short post I’ll introduce a csh script I wrote recently. I wrote it for a certain purpose and it’s definitely not “general purpose”. I’m posting it here so you/I can use it as a reference.

The script uses these programs:

1. youtube-dl    (In ubuntu, you can get it by typing : sudo apt-get install youtube-dl).

2. ffmpeg   (Again: sudo apt-get install ffmpeg)

3. avimerge (part of the transcode package: sudo apt-get install transcode)

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , ,

Monday, January 26th, 2009 Shell Scripts 2 Comments

Query Google Finance From the Command Line

This is a one line bash script I wrote to query a stock’s price from Google Finance. It uses wget to get the HTML page from Google Finance and then grep and cut to extract the stock’s price. The script is based on the current HTML format of the Google Finance pages and might not work if Google decide to change this format (It’s easy to modify, though).

To have the script:

Open your favorite text editor (mine is vim), and type/paste this:

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , ,

Friday, December 26th, 2008 Command Line No Comments

Take Screenshots in Linux with “scrot”

I have found this tool recently, and I have no idea how I was able to manage without it before.

This tool allows you to capture any region of your screen, by selecting it with your mouse, clicking on the title-bar of a window and other methods. It’s very flexible and contains many options.

To download the program in Ubuntu:

sudo apt-get install scrot

Now, open a new text file and type this

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , ,

Friday, November 14th, 2008 Linux 9 Comments

Todo.txt – A simple yet powerful todo manager for Linux

Recently, I discrovered todo.txt, a great todo list manager for people who feel comfortable with Linux’s command line.

The greatness of this tool is in its simplicity: the whole todo list is saved as plain text, and operations like adding/removing/prioritarizing/modifying/listing items are done through a very simple command line interface supplied in a bash script.

› Continue reading

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tags: , , ,

Saturday, October 18th, 2008 Linux 2 Comments
my email
my photo
Hi,
My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and a BSc. in electrical engineering from The Electrical Engineering school , Technion , Israel.
I'm a Verification Engineer in Mellanox Technologies Ltd.
I love Linux, the Command Line and the OpenSource Community.
I used to write Poems (Arabic) when I was able to find time for this.
February 2012
S M T W T F S
« Sep    
 1234
567891011
12131415161718
19202122232425
26272829  
SEO Powered by Platinum SEO from Techblissonline

Twitter links powered by Tweet This v1.7.4, a WordPress plugin for Twitter.