You are not logged in.

#1 2005-12-14 04:30:57

M6
Member
Registered: 2005-09-18
Posts: 29

Should I write an executable -how to?

Hi,
As you can see I have no idea about programming.

I have an app in my /home/download   called look.

Only way i can call this app is to open a terminal in /home/download then type /usr/loacl/bin/look.

I'd like to just type look anywhere/any drectory and  get this prog launched- just like firefox.
(I  can type firefox any terminal it opens up)

I''d rather not mess with the prog look.

I thought if I can have a bin file in /root/bin which will do:

cd /home/download
/usr/local/bin/look

Is this a possibility or is there a better way.

Please don't laugh.

Regards
Ben


Arch a Day Keeps Wfie Away

Offline

#2 2005-12-14 05:22:23

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Should I write an executable -how to?

well, it looks like you need a shell script, considering the need to "cd" before running the app.

Save the following:

#!/bin/bash
cd /home/download
exec /usr/local/bin/look

to a file called "mylook"

As root, mv that file to /usr/bin and run "chmod 755 /usr/bin/mylook"

From then on, you can just type "mylook".  Be very careful if you name this script "look", because that aready exists:

/usr/bin/look is owned by util-linux 2.12-9

Offline

#3 2005-12-14 05:40:48

M6
Member
Registered: 2005-09-18
Posts: 29

Re: Should I write an executable -how to?

Wow! Thank you that did the trick.

My Arch is getting closer to "perfect"
Regards

Ben


Arch a Day Keeps Wfie Away

Offline

#4 2005-12-14 06:09:57

shadowhand
Member
From: MN, USA
Registered: 2004-02-19
Posts: 1,142
Website

Re: Should I write an executable -how to?

Even better would be:

#!/bin/bash
CURRENT_DIR=`pwd`
cd /home/download
exec /usr/local/bin/look && cd $CURRENT_DIR

·¬»· i am shadowhand, powered by webfaction

Offline

#5 2005-12-14 06:24:23

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Should I write an executable -how to?

The last cd will never get called because "exec" completely overwrites the running process - you'd want to remove the exec if you used shadowhand's version

Offline

#6 2005-12-14 10:55:36

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: Should I write an executable -how to?

instead of using

CURRENT_DIR=`pwd`

for the old path you can just use a dash to cd.

cd /home/download
/usr/local/bin/look && cd -

Offline

Board footer

Powered by FluxBB