key detection in a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting key detection in a script
# 1  
Old 10-05-2007
Question key detection in a script

Heloo every one
I want to write a script that detects a key press and mouse click and movement,but I dont know how.
The second one is I want to run myscript without writing the shell ie not "sh script.sh" but "script.sh"
Can you help me out of here?
Thanks in advance.
# 2  
Old 10-05-2007
You may want to check out Chris F.A Johnson's article Unix Review > Shell Corner: Mouse Reporting in a Shell Script
# 3  
Old 12-21-2007
Hi Vino,
the website you told me is the best so far.Thanks!
# 4  
Old 12-25-2007
Quote:
Originally Posted by enoch99
I want to run myscript without writing the shell ie not "sh script.sh" but "script.sh"

Give your script execute permissions:
Code:
chmod +x script.sh

Note that if it is in the current directory (or any directory not in your PATH), you will have to tell the shell where to find it, e.g.:
Code:
./script.sh

# 5  
Old 02-28-2008
What I wanted is to run the shell script program like any command just typing the omly the name not with an extension like .sh and preceeding the name of the shell i.e
Not- sh filename.sh
But- filename
Thanks.
# 6  
Old 02-28-2008
Quote:
Originally Posted by enoch99
What I wanted is to run the shell script program like any command just typing the omly the name not with an extension like .sh and preceeding the name of the shell i.e
Not- sh filename.sh
But- filename

If you don't want an extension, don't name the file with one.

If you want to type just the name of the file to execute it, give the file execute permissions:

Code:
chmod +x filename

# 7  
Old 02-28-2008
Quote:
Originally Posted by enoch99
What I wanted is to run the shell script program like any command just typing the omly the name not with an extension like .sh and preceeding the name of the shell i.e
Not- sh filename.sh
But- filename
Thanks.
I think you are mixing concepts.

File extensions have no meaning to the OS in UNIX, as they have in Windows. You could name your script whatever you want. But, in order to run it, as cfajohnson has told you, you have to set exec perms.

On the other hand, what you want is to avoid the use of either "sh" before the name of the script, and the use o "./" after it. To do so, you have at least two possibilities:
- Add the directory which contains the binary to your PATH variable.
- Copy or link it in one directory that's already in your PATH.

Regards.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script @ Find a key word and If the key word matches then replace next 7 lines only

Hi All, I have a XML file which is looks like as below. <<please see the attachment >> <?xml version="1.0" encoding="UTF-8"?> <esites> <esite> <name>XXX.com</name> <storeId>10001</storeId> <module> ... (4 Replies)
Discussion started by: Rajeev_hbk
4 Replies

2. Programming

Parallel Processing Detection and Program Return Value Detection

Hey, for the purpose of a research project I need to know if a specific type of parallel processing is being utilized by any user-run programs. Is there a way to detect whether a program either returns a value to another program at the end of execution, or just utilizes any form of parallel... (4 Replies)
Discussion started by: azar.zorn
4 Replies

3. Solaris

Solaris 8 ssh public key authentication issue - Server refused our key

Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks. ... (1 Reply)
Discussion started by: aixlover
1 Replies

4. Shell Programming and Scripting

need bash script Intrusion Detection on Linux

Hello all I have a script but I failed on the creation of Script is any is carried out in the shell sends the owner of the server, the message is has been implemented For example, functioned as a detection system intruders but in smaller Is it possible to help if you allow I want the... (4 Replies)
Discussion started by: x-zer0
4 Replies

5. Shell Programming and Scripting

File detection then run script

I am currently running 4 scripts to complete a job for me. Each script requires the finished file of the one before it. For example the first script gets the finished file called model.x, then i would like script2 to start in and use model.x as the input and get model_min.x as the finished... (5 Replies)
Discussion started by: olifu02
5 Replies

6. Shell Programming and Scripting

Backspace Key From Within Script

I have a script that asks a user for a few question. I would like the users to be able to use the backspace key if they make a mistake. Right now when they try they get ^? instead of it backing up. As you can see here from a stty -a the backspace is set... speed 38400 baud; rows = 42;... (2 Replies)
Discussion started by: LRoberts
2 Replies

7. Shell Programming and Scripting

A simple intrusion detection script

If you have a very static Linux server and you want to make sure it's not messed with, here's a simple script that will tell you if any files have been tampered with. It's not as fancy or as secure as tripwire or those others, but it is very simple. It can be easily adapted to any *NIX OS. ... (3 Replies)
Discussion started by: otheus
3 Replies

8. UNIX for Dummies Questions & Answers

Pressing backspace key simulates enter key

Hi, Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused: Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies
Login or Register to Ask a Question