Thread View: alt.uu.comp.os.linux.questions
16 messages
16 total messages
Started by Dominic Tse
Sat, 21 Aug 1999 00:00
Can Red Hat Linux run Shell Script?
Author: Dominic Tse
Date: Sat, 21 Aug 1999 00:00
Date: Sat, 21 Aug 1999 00:00
13 lines
1646 bytes
1646 bytes
Hi, I'm a newie of Linux. As I am currently studying Systems Programming (Unix), I have installed Linux on my PC to practice and familiar with it. I am currently trying to run C shell script under the Linux. It seems to me that it doesn't like to execute the script although I've done "chmod u+x script_program". The error message is something like "command not found". Can anyone please give me some ideas? -- dom dominictse@netscape.net http://homepages.tig.com.au/~jtse/
Re: Can Red Hat Linux run Shell Script?
Author: Peter Marks
Date: Sat, 21 Aug 1999 00:00
Date: Sat, 21 Aug 1999 00:00
33 lines
2259 bytes
2259 bytes
The default is bash but to make a file execute with csh have the first line as #!/bin/csh and combined with the chmod +x that you've done the script will run with csh. Note that this technique works with anthing that can run a script, it's commonly used with perl or python for example. peter PS: I just noticed you've cross-posted like crazy. I hope you get flodded with replys. Tone it down in future. Dominic Tse <dominictse@netscape.net> wrote in message news:7plmre$8e1$1@toto.tig.com.au... > Hi, > > I'm a newie of Linux. As I am currently studying Systems Programming (Unix), > I have installed Linux on my PC to practice and familiar with it. I am > currently trying to run C shell script under the Linux. It seems to me that > it doesn't like to execute the script although I've done "chmod u+x > script_program". The error message is something like "command not found". > Can anyone please give me some ideas? > > -- > dom > dominictse@netscape.net > http://homepages.tig.com.au/~jtse/ > >
Re: Can Red Hat Linux run Shell Script?
Author: Jason Clifford
Date: Sat, 21 Aug 1999 00:00
Date: Sat, 21 Aug 1999 00:00
23 lines
2301 bytes
2301 bytes
On Sat, 21 Aug 1999, Dominic Tse wrote:
> I'm a newie of Linux. As I am currently studying Systems Programming (Unix),
> I have installed Linux on my PC to practice and familiar with it. I am
> currently trying to run C shell script under the Linux. It seems to me that
> it doesn't like to execute the script although I've done "chmod u+x
> script_program". The error message is something like "command not found".
> Can anyone please give me some ideas?
how are you calling your script? If you are not using ./ to explicitely
point to the script the system will not be able to find it.
Do remember that the current directory (.) is NOT in your PATH by default
and should not be there.
Try ./script_program.
Oh, and execute rpm -q tcsh to ensure that you do actually have the csh
package installed.
Jason Clifford http://www.dlsl.demon.co.uk/
** Specialist Linux Consultancy and Support Services **
**** Linux Workstation and Server Systems ****
Re: Can Red Hat Linux run Shell Script?
Author: kf
Date: Sat, 21 Aug 1999 00:00
Date: Sat, 21 Aug 1999 00:00
26 lines
2614 bytes
2614 bytes
Dominic Tse wrote:
> I'm a newie of Linux. As I am currently studying Systems Programming (Unix),
> I have installed Linux on my PC to practice and familiar with it. I am
> currently trying to run C shell script under the Linux. It seems to me that
> it doesn't like to execute the script although I've done "chmod u+x
> script_program". The error message is something like "command not found".
> Can anyone please give me some ideas?
I'm guessing that you haven't included the path to the script. For example,
if your script is called "boink" and is in the subdirectory "/usr/local/bin",
then you could execute it with the command "/usr/local/bin/boink".
Alternatively, put your script in a subdirectory which is in the already existing
path (do "env | grep -i path" to find out) or include the directory in which your
script resides in the path; for example, if you have the script in your home
directory, put the following in your ".profile" file: "$PATH=$PATH:$HOME".
Best luck,
kf
--
-------------------------------------------------------------------
If it won't run gnu/Linux, your hardware's not upwardly compatible.
ken@cleveland.lug.net
-------------------------------------------------------------------
###
Re: Can Red Hat Linux run Shell Script?
Author: Tim Hanson
Date: Sat, 21 Aug 1999 00:00
Date: Sat, 21 Aug 1999 00:00
20 lines
1889 bytes
1889 bytes
"Dominic Tse" <dominictse@netscape.net> wrote: >Hi, > >I'm a newie of Linux. As I am currently studying Systems Programming (Unix), >I have installed Linux on my PC to practice and familiar with it. I am >currently trying to run C shell script under the Linux. It seems to me that >it doesn't like to execute the script although I've done "chmod u+x >script_program". The error message is something like "command not found". >Can anyone please give me some ideas? > >-- >dom >dominictse@netscape.net >http://homepages.tig.com.au/~jtse/ > > Make sure either it's either in your path or you call it by including the whole path. If it's in your current directory, call it by typing ./script_program.
Re: Can Red Hat Linux run Shell Script?
Author: Nick Ruisi
Date: Sun, 22 Aug 1999 00:00
Date: Sun, 22 Aug 1999 00:00
24 lines
1786 bytes
1786 bytes
1: chmod 755 /script_FileName cd script_FileNameDirectory ./script_FileName 2: sh /fullPathToScript Dominic Tse wrote: > Hi, > > I'm a newie of Linux. As I am currently studying Systems Programming (Unix), > I have installed Linux on my PC to practice and familiar with it. I am > currently trying to run C shell script under the Linux. It seems to me that > it doesn't like to execute the script although I've done "chmod u+x > script_program". The error message is something like "command not found". > Can anyone please give me some ideas? > > -- > dom > dominictse@netscape.net > http://homepages.tig.com.au/~jtse/
Re: Can Red Hat Linux run Shell Script?
Author: Erik Duisters
Date: Mon, 23 Aug 1999 00:00
Date: Mon, 23 Aug 1999 00:00
32 lines
2008 bytes
2008 bytes
Hi, If you don't like the ./ in front of you're script_FileName make sure "." is part of the PATH environment variable. Nick Ruisi wrote: > 1: > chmod 755 /script_FileName > cd script_FileNameDirectory > ./script_FileName > > 2: > sh /fullPathToScript > > Dominic Tse wrote: > > > Hi, > > > > I'm a newie of Linux. As I am currently studying Systems Programming (Unix), > > I have installed Linux on my PC to practice and familiar with it. I am > > currently trying to run C shell script under the Linux. It seems to me that > > it doesn't like to execute the script although I've done "chmod u+x > > script_program". The error message is something like "command not found". > > Can anyone please give me some ideas? > > > > -- > > dom > > dominictse@netscape.net > > http://homepages.tig.com.au/~jtse/
Re: Can Red Hat Linux run Shell Script?
Author: Jason Clifford
Date: Mon, 23 Aug 1999 00:00
Date: Mon, 23 Aug 1999 00:00
13 lines
1845 bytes
1845 bytes
On Mon, 23 Aug 1999, Erik Duisters wrote:
> If you don't like the ./ in front of you're script_FileName make sure "." is part
> of the PATH environment variable.
This is VERY bad advise. Having "." in your PATH env is a HUGE security
risk.
It is far better to get into the habbit of using ./
Jason Clifford http://www.dlsl.demon.co.uk/
** Specialist Linux Consultancy and Support Services **
**** Linux Workstation and Server Systems ****
Re: Can Red Hat Linux run Shell Script?
Author: Alex Pozgaj
Date: Tue, 24 Aug 1999 00:00
Date: Tue, 24 Aug 1999 00:00
21 lines
2044 bytes
2044 bytes
Jason Clifford <jason@dlsl.demon.co.uk> writes: > On Mon, 23 Aug 1999, Erik Duisters wrote: > > > If you don't like the ./ in front of you're script_FileName make sure "." is part > > of the PATH environment variable. > > This is VERY bad advise. Having "." in your PATH env is a HUGE security > risk. > > It is far better to get into the habbit of using ./ It is - if you are root. Otherwise it's OK. Cheers, alex. -- "Some people have told me they don't think a fat penguin really embodies the grace of Linux, which tells me they have never seen an angry penguin charging at them in excess of 100mph. They be a lot more careful of what they say if they had". -- Linus Torvalds
Re: Can Red Hat Linux run Shell Script?
Author: John Winters
Date: Tue, 24 Aug 1999 00:00
Date: Tue, 24 Aug 1999 00:00
27 lines
2250 bytes
2250 bytes
In article <xak3dx9tvfs.fsf@par.univie.ac.at>, Alex Pozgaj <alex@par.univie.ac.at> wrote: >Jason Clifford <jason@dlsl.demon.co.uk> writes: > >> On Mon, 23 Aug 1999, Erik Duisters wrote: >> >> > If you don't like the ./ in front of you're script_FileName make sure "." is part >> > of the PATH environment variable. >> >> This is VERY bad advise. Having "." in your PATH env is a HUGE security >> risk. >> >> It is far better to get into the habbit of using ./ > >It is - if you are root. Otherwise it's OK. ...provided there are no other users of your system with possible malicious intent. If you run a single user Linux system at home it's perhaps acceptable (although a bad habit). If you use any kind of shared system it's a big no-no. John -- John Winters. Wallingford, Oxon, England. The Linux Emporium - a source for Linux CDs in the UK See http://www.linuxemporium.co.uk/
Re: Can Red Hat Linux run Shell Script?
Author: Doug Mast
Date: Wed, 25 Aug 1999 00:00
Date: Wed, 25 Aug 1999 00:00
19 lines
2107 bytes
2107 bytes
On 24 Aug 1999 10:46:39 +0100, John Winters <john@polo.demon.co.uk> wrote: > In article <xak3dx9tvfs.fsf@par.univie.ac.at>, > Alex Pozgaj <alex@par.univie.ac.at> wrote: > >Jason Clifford <jason@dlsl.demon.co.uk> writes: > >> This is VERY bad advise. Having "." in your PATH env is a HUGE security > >> risk. It is far better to get into the habbit of using ./ > > > >It is - if you are root. Otherwise it's OK. > > ...provided there are no other users of your system with possible > malicious intent. If you run a single user Linux system at home it's > perhaps acceptable (although a bad habit). If you use any kind of > shared system it's a big no-no. Well, the risk is pretty minimial if "." appears last in your path. That way, the real "ls" or whatever will be called instead of a trojan "ls" that does something nasty. . . Doug.
Re: Can Red Hat Linux run Shell Script?
Author: 'Dungeon' Dave
Date: Sun, 29 Aug 1999 00:00
Date: Sun, 29 Aug 1999 00:00
49 lines
2999 bytes
2999 bytes
In article <7plmre$8e1$1@toto.tig.com.au>, Dominic Tse <dominictse@netscape.net> writes >Hi, > >I'm a newie of Linux. As I am currently studying Systems Programming >(Unix), >I have installed Linux on my PC to practice and familiar with it. I am >currently trying to run C shell script under the Linux. It seems to me that >it doesn't like to execute the script although I've done "chmod u+x >script_program". The error message is something like "command not >found". >Can anyone please give me some ideas? yeah.... are you actually running the c-shell as a login shell, or are you in the Bourne Again (bash) or Korne (ksh) instead? Is your shell script actually scripting language or a C program? I just as many people think that they can use the C-shell as a C interpreter and try to run C programs without compilation (can it be done? I'm happy to be proved wrong!!) Secondly, if you definitely want your script to execute in a c shell, put the following in the first line: #! /bin/csh The #! specifies which shell the script should run in, the /bin/csh is the path to the c shell (use the command "which csh" to find out where yours is, it may be /usr/bin/csh etc). Lastly: avoid calling your program SCRIPT or TEST - these are two of the most common names used and are also reserved keywords. I have made the same mistake myself many times!! Also: is the script file located somewhere in your path? You haven't placed the file somewhere where off the search path, have you? Try "echo $PATH" and see if you've placed it in any of the listed locations. > >-- >dom >dominictse@netscape.net >http://homepages.tig.com.au/~jtse/ > > -- Linux: love it or loathe it, it's here to stay!! (I need a service pack for my tagline)
Re: Can Red Hat Linux run Shell Script?
Author: 'Dungeon' Dave
Date: Sun, 29 Aug 1999 00:00
Date: Sun, 29 Aug 1999 00:00
38 lines
2805 bytes
2805 bytes
In article <xak3dx9tvfs.fsf@par.univie.ac.at>, Alex Pozgaj <alex@par.univie.ac.at> writes >> > If you don't like the ./ in front of you're script_FileName make sure "." is >part >> > of the PATH environment variable. >> >> This is VERY bad advise. Having "." in your PATH env is a HUGE >security >> risk. >> >> It is far better to get into the habbit of using ./ > >It is - if you are root. Otherwise it's OK. No, it's not. It is still a BIG security problem, as an ordinary user could run a program from someone else's directory rather than run the system-wide program. eg: if I put: chmod 777 ~$HOME/* 1&2>/dev/null echo $LOGNAME permissions open >>.testrc ls $* as a script file in my home directory (or hid it in /etc) and someone went in there and typed "ls" to look at my directory, it'd open their file permissions wide open and include an entry in a .testrc file to let me know. It's far better to get into the habit of using ./ to address the file directly, rather than risk running something that could be hidden elsewhere but still on my path. Too many security problems have been caused by privileged users typing commands that are fine for their ordinary login but potentially catastrophic during their privileged login session. You can't compensate for bad practise!! -- Linux: love it or loathe it, it's here to stay!! (I need a service pack for my tagline)
Re: Can Red Hat Linux run Shell Script?
Author: Tim Haynes
Date: Mon, 30 Aug 1999 00:00
Date: Mon, 30 Aug 1999 00:00
20 lines
2124 bytes
2124 bytes
Nick Ruisi <nick_ruisi@softhome.net> doodled in uk.comp.os.linux: > 1: > chmod 755 /script_FileName > cd script_FileNameDirectory > ./script_FileName > > 2: > sh /fullPathToScript I thought the whole point was that it was a C-shell script, not bourne?? (And goodness knows whether he was using csh as his login shell or not...) -- ~Tim ___ http://www.glutinous.custard.org/ _______ tim@glutinous.custard.org ____ | Geek Code: GCS dpu s-:+ a-- C++++ UBLUAVHSC++++ P+++ L++ E--- W+++(--) N++ | | w--- O- M-- V-- PS PGP++ t--- X+(-) b D+ G e++(*) h++(*) r--- y- | | .|` Clouds cross the black moonlight / | | Rushing on down to the circle of the turning world .|` (Runrig) | `----------------------------------------------------------------------------'
Re: Can Red Hat Linux run Shell Script?
Author: Tim Haynes
Date: Mon, 30 Aug 1999 00:00
Date: Mon, 30 Aug 1999 00:00
25 lines
2453 bytes
2453 bytes
Peter Marks <peter.marks@pobox.com> doodled in uk.comp.os.linux: > The default is bash but to make a file execute with csh have the first line > as > #!/bin/csh > and combined with the chmod +x that you've done the script will run with > csh. Note that this technique works with anthing that can run a script, it's > commonly used with perl or python for example. Yes, but you're forgetting one big thing - if you're running csh you'll have to add . to the path (no, not the PATH), and do a 'rehash' to get it to search again. > PS: I just noticed you've cross-posted like crazy. I hope you get flodded > with replys. Tone it down in future. Too right. -- ~Tim ___ http://www.glutinous.custard.org/ _______ tim@glutinous.custard.org ____ | Geek Code: GCS dpu s-:+ a-- C++++ UBLUAVHSC++++ P+++ L++ E--- W+++(--) N++ | | w--- O- M-- V-- PS PGP++ t--- X+(-) b D+ G e++(*) h++(*) r--- y- | | .|` Clouds cross the black moonlight / | | Rushing on down to the circle of the turning world .|` (Runrig) | `----------------------------------------------------------------------------'
Re: Can Red Hat Linux run Shell Script?
Author: Tim Haynes
Date: Mon, 30 Aug 1999 00:00
Date: Mon, 30 Aug 1999 00:00
25 lines
2700 bytes
2700 bytes
kf <ken@cleveland.lug.net> doodled in uk.comp.os.linux: > Alternatively, put your script in a subdirectory which is in the already > existing path (do "env | grep -i path" to find out) or include the directory > in which your script resides in the path; for example, if you have the > script in your home directory, put the following in your ".profile" file: > "$PATH=$PATH:$HOME". That's a bourne shell + derivatives thing. As I said earlier, in csh it's path, not PATH, you don't export it but you setenv it, and you rehash to get the shell to look again the next time, although this depends on whether he really is running (t)csh instead of bash in order to execute the script. OTOH under no circumstances will '$PATH=$PATH:$HOME' in .profile do what he wanted it to do! (You've not said to export PATH afterwards, $HOME isn't necessarily where his script it, and $PATH is not an lvalue...) -- ~Tim ___ http://www.glutinous.custard.org/ _______ tim@glutinous.custard.org ____ | Geek Code: GCS dpu s-:+ a-- C++++ UBLUAVHSC++++ P+++ L++ E--- W+++(--) N++ | | w--- O- M-- V-- PS PGP++ t--- X+(-) b D+ G e++(*) h++(*) r--- y- | | .|` Clouds cross the black moonlight / | | Rushing on down to the circle of the turning world .|` (Runrig) | `----------------------------------------------------------------------------'
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads