Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-20-2007, 11:03 AM   #1
LQ Newbie
Registered: Aug 2006
Posts: 9

Rep: Reputation: 0
linux command wrapper


I have a properietary linux running on my server. System is
capable of running under low memory conditions.
I have a vi editor available on the system.

I want to create a shell script wrapper over the actual vi command. I
am planning to verify available memory
before launching vi editor. So when somebody types vi command on the
shell prompt, it should invoke my wrapper
then my wrapper would invoke the actual vi editor after verification.

Can somebody let me know what all things I have to change in the
system in order to make this setup work.

Thanks in advance,
Old 11-20-2007, 11:35 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I'm sure there are lots of ways to do this.

What I would try first:

In the directory where vi lives, rename vi to (e.g.) "realvi". Then, create a link to your script and name the link "vi". In your script, you would call "realvi"
Old 11-20-2007, 01:46 PM   #3
LQ Newbie
Registered: Jun 2006
Posts: 20

Rep: Reputation: 0
mv /bin/vi /bin/vireal
ln -s (your script path) /bin vi
vireal (your script):
freemem=`free -m | grep Mem | awk '{print $3}'`
if [ $freemem -lt (your memory cap) ]; then
echo "not enough memory to run vi"
exit 1
vireal $1
Old 11-21-2007, 11:01 AM   #4
LQ Newbie
Registered: Aug 2006
Posts: 9

Original Poster
Rep: Reputation: 0
thanks for the replies

This seems to be easier than I thought....

Any idea if we can proxy some of the shell builtins in the similar way.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is a command wrapper? johnsanty Programming 5 09-22-2006 02:19 PM
NDIS Wrapper Help Please FuGeE Linux - Wireless Networking 1 12-11-2004 11:14 AM
OS Wrapper ines Linux - Software 10 11-04-2004 06:57 AM
FTP wrapper dominant Linux - Security 9 03-25-2004 03:34 AM
ndis wrapper citrus Linux - Hardware 3 01-08-2004 06:10 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:34 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration