Register
It is currently Mon Dec 22, 2014 2:09 pm

executable test


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Mon Nov 21, 2011 11:42 am   

Joined: Thu Nov 10, 2011 7:31 pm
Posts: 21
I need a script that 1. tests if a file is executable 2. if it is, than exit with status 1, and if it is not, then chmod 777, and then run it with #! /bin/bash -x, and return it to the normal #! /bin/bash when done


Top
 Profile  
 PostPosted: Mon Nov 21, 2011 11:53 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 579
you need to learn about test builtin.


Top
 Profile  
 PostPosted: Mon Nov 21, 2011 11:57 am   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
jsz wrote:
blendmaster345 wrote:
I haven't tried it, but it looks good! I just did not know how to check for existence of a file.


That's part of the basics.

Read the output of the following command:

Code:
help test



You know how to check whether a file is executable.
You know how to exit from a script with a specific status.
You know how to use chmod(1) on a file.

Now, read the output of the set(0) builtin:
Code:
help set


And learn how to execute a script with the -x switch, by yourself.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP