The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bash search function doze Shell Programming and Scripting 3 09-30-2008 06:06 PM
[BASH - KSH] Passing array to a function ripat Shell Programming and Scripting 3 04-17-2008 09:17 AM
Need help in using power function in Bash ahjiefreak Shell Programming and Scripting 3 03-26-2008 04:31 AM
Need assistance with bash function _jade_ Shell Programming and Scripting 1 03-05-2008 06:02 PM
Mimic bash history behavior sysera Shell Programming and Scripting 0 10-13-2005 05:48 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-06-2009
inquen inquen is offline
Registered User
  
 

Join Date: Apr 2009
Location: New York City
Posts: 7
Talking History for custom BASH function

Hello all, I have a bash function that opens Safari (I'm on OS X) with a specified argument.

Here it is :


Code:
function safari
{

#Safari bash function

TLDS=( "http://www."  ".com"  ".org"  ".net"  ".gov"  ".edu" )

if [ $1 = "-o" ]; then
open -a Safari ${TLDS[0]}$2${TLDS[2]} 
	elif [ $1 = "-n" ]; then
	open -a Safari ${TLDS[0]}$2${TLDS[3]}
		elif [ $1 = "-g" ]; then
		open -a Safari ${TLDS[0]}$2${TLDS[4]}
			elif [ $1 = "-e" ]; then
			open -a Safari ${TLDS[0]}$2${TLDS[5]}
				elif [ $1 = "-c" ]; then
				open -a Safari ${TLDS[0]}$2${TLDS[1]}
					else
					open -a Safari ${TLDS[0]}$1${TLDS[1]}
fi

}

I don't have a problem with the function, but I would like to know if my function can have a command history, like after each argument is taken, is it possible that i could write it to a file for later retrieval?

for example after a ( this is my prompt ) :

(%) ~ <-- safari arstechnica // opens Safari @ arstechnica.com

(%) ~ <-- safari ars[TAB] // completes as arstechnica after reading file

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:25 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0