You are not logged in.

#1 2008-04-03 04:53:44

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

shell filter

I'd like to pre-process my command lines before/while bash interprets them.

For example, I'd like

$ firefox

to become (bash)

$ firefox &>> log &

I'd probably like to keep a file somewhere were I define which replacements should take place.

The thing is, shells do all sorts of cool things: a short user-entered command like

$ echo $PWD

is converted to something which may look like

$ /bin/echo /home/peets

before it is executed.

I'd like to intercept the pre-processed statement, modify it, then send it to be executed.

Is this possible?

Motivation can be found in the thread on a graphics terminal

Offline

#2 2008-04-03 08:07:09

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: shell filter

For the firefox example, you could put 'alias firefox='firefox &>> log &' in ~/.bashrc, or are you after something more?


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#3 2008-04-03 12:52:06

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: shell filter

I have a few aliases, but I'd like something smarter.

Well, actually, managing a file of "replacements" is almost exactly the same as managing a list of aliases. I think I'll use that method.

Offline

Board footer

Powered by FluxBB