Operating System - HP-UX
1748243 Members
4152 Online
108760 Solutions
New Discussion юеВ

Re: How to make a bourne shell script executable?

 
SOLVED
Go to solution
H.Merijn Brand (procura
Honored Contributor

Re: How to make a bourne shell script executable?

Ehhh, and don't use fixed file names for temporary files, there is a great function for that: mktemp ()

# man 3 mktemp
Enjoy, Have FUN! H.Merijn
Juan Manuel L├│pez
Valued Contributor

Re: How to make a bourne shell script executable?

Hi all.
You have to give execute permision to your script file:
chmod 700 < file >

I hope this help you.


Juanma.
I would like to be lie on a beautiful beach spending my life doing nothing, so someboby has to make this job.
Chua Wen Ching
Regular Advisor

Re: How to make a bourne shell script executable?

Sorry for not replying as i was very busy these few days.

Dear Rory R Hammond
--------------------
I had download the file shc-2.4a-sd-10.20.depot. I am able to unzip it but how am i suppose to install/run the shc? If i am not a unix root/administrator and just a normal user, can i still install it into my account. Thank you.

Dear Juan Manuel Lo
--------------------
When i chmod 700 < test.sh > there is an error:
sh: Syntax Error: `newline or ;' is not expected. I not sure whether HP-UX 10.20 can do that.

Dear Gerard Leclercq
---------------------
Thanks for your C code. But when i want to make test.sh (a sample script) executable, anything to do with temporary files? Is it you want me to name test.sh to .test? Anyway can you explain more details about your code. Maybe comments. I am not that good in C. :D

Dear procura
------------
I had read through the man 3 mktemp but it does not teach me how to use it. Is it implemented in C rather than bourne shell script? Any sample implmentation on bourne/Posix script.

Dear Yogeeraj
-------------
Cool...i just know how to make a c program executable rather than keep using the old way (a.out). Thanks a lot. But i want to make a bourne shell script executable rather than C or perl.

Anyway thanks for your replies. It really help me learn more about UNIX. Thank you.

wenching
Rory R Hammond
Trusted Contributor

Re: How to make a bourne shell script executable?

If you want, I will send the source code and you can then install it in you bin directory
There are a 100 ways to do things and 97 of them are right
Rodney Hills
Honored Contributor

Re: How to make a bourne shell script executable?

If the source is ultra sensitive then I have 2 recommendations.

1)
You can use "sudo" to run it.

sudo abc.sh

The downside is the shell script will run as "root". But then no one can look at the source.

--- or ---

2) You can use group permissions on a wrapper script. Not entirely recommended, but can be made secure.

script1.sh has group ownership of "secret" and the set gid bit is set (chmod 2755 script1).
abc.sh has group ownership of "secret" and the group permissions are read (chmod 755 abc.sh).

abc.sh is visible only to people who are members of the "secret" group. script1.sh is visible to everyone. When script1.sh is ran, the script will have access to run abc.sh.

my 2 cents
-- Rod Hills

There be dragons...
Rodney Hills
Honored Contributor

Re: How to make a bourne shell script executable?

Correction to my previous post-

In part 2), it should be

chmod 750 abc.sh

-- Rod Hills
There be dragons...