The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Memoryleak detection using MALLOCDEBUG Lazzar AIX 0 03-30-2008 08:55 AM
external USB detection problems mahendrakamath Filesystems, Disks and Memory 2 11-19-2007 11:33 AM
usb hdd detection problem mahendrakamath UNIX for Dummies Questions & Answers 0 11-16-2007 11:42 AM
Extrusion Detection is Ripe for CEP iBot Complex Event Processing RSS News 0 07-10-2007 03:50 PM
virus detection pbonilla UNIX for Dummies Questions & Answers 1 11-20-2002 10:14 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-05-2007
enoch99 enoch99 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 5
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 (permalink)  
Old 10-05-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
You may want to check out Chris F.A Johnson's article Unix Review > Shell Corner: Mouse Reporting in a Shell Script
  #3 (permalink)  
Old 12-21-2007
enoch99 enoch99 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 5
Hi Vino,
the website you told me is the best so far.Thanks!
  #4 (permalink)  
Old 12-25-2007
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by enoch99 View Post
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 (permalink)  
Old 02-28-2008
enoch99 enoch99 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 5
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 (permalink)  
Old 02-28-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by enoch99 View Post
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 (permalink)  
Old 02-28-2008
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Quote:
Originally Posted by enoch99 View Post
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.
Reply

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 06:05 AM.


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