Script doesn't run


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script doesn't run
# 1  
Old 12-26-2009
Script doesn't run

Hi everyone,

I've written a script, I gave it permission by
> chmod u+x myscript

and then tried to run it with
> myscript

and it didn't work, so I've written
> ./myscript

again, it didn't work, so I've written
> set path = (. $path)
but it didn't work as well.

I have some experience with unix and cshell (the script I wrote is a cshell one), and those are the only solutions I know for tracking a script in a path.

If you have any idea, I would love to hear it.
Thanks so much and happy holidays,
Shira. Smilie
# 2  
Old 12-26-2009
When you say did not run, what message did you get? You say you've written a csh script, which I assume is not the same as your interactive shell? Did you set the shebang correctly on the first line of your script. e.g.:
Code:
#!/bin/csh

Did you verify that csh exists at that location?

Last edited by Scrutinizer; 12-26-2009 at 06:27 PM..
# 3  
Old 12-26-2009
Of course, I've written many scripts in this environment.

I'm using a different computer now, and I know that it doesn't mean anything, but if it helps, the previous computer had windows xp os and now I have vista. Again, it doesn't mean anything, but perhaps it's a vital information.

And yes, I've written in the beginning of the script
#!/usr/local/bin/tcsh -f

When I try to run it, it says:
myscript: Command not found

Thanks,
Shira.
# 4  
Old 12-26-2009
Please show the output of
Code:
which tcsh

# 5  
Old 12-26-2009
the output is:

/bin/tcsh

thanks,
Shira.
# 6  
Old 12-26-2009
Then you should change the first line of your script to
Code:
#!/bin/tcsh -f

# 7  
Old 12-26-2009
Hi Jim!

Now I see what you mean.
I changed the opening of my script to just
#!/bin/tcsh -f

and now it works.
I had it in mind, but I've never thought it was the reason.
I guess it was because I changed my computer.

Thanks so much,
Shira.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

Script containing Curl doesn't run with crontab

Hello I have a problem with the crontab command when I run a code containing Curl on the command line it runs without fail but as soon as I program it with crontab it executes everything except the curl returns fail thank you for helping me to resolve this problem because since Monday I look... (14 Replies)
Discussion started by: beautymind
14 Replies

3. Shell Programming and Scripting

Cron doesn't run job in background

Hi, First of all merry christmas and Happy holidays to all :D My situation is as below, When a backup job runs on a mainframe server, it creates a 0byte file on a network drive which is accessible through linux Linux server : Red Hat Enterprise Linux Server release 5.3 Beta (Tikanga) File... (6 Replies)
Discussion started by: sam05121988
6 Replies

4. Shell Programming and Scripting

Start scripts if it doesn't run on other node

Hello community, I created a script to simply query DB and then analize data. The environment where the script will works is two RedHat machines that access both to an external database. My script runs from the first crontab node. But what about if the first node goes down? What I need is copy... (2 Replies)
Discussion started by: Lord Spectre
2 Replies

5. Shell Programming and Scripting

how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question. the script goes away and check traffic information, for example check_GE-VLANStats-P3 1.1.1.1 and returns the results ok. how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
Discussion started by: llcooljatt
26 Replies

6. Shell Programming and Scripting

Doesn't run as a cronjob...

Hi! I have a svn backup script that works perfectly if I execute it from the command line but if I set it as a cronjob to run at night, only part of the code works. So, basically the scripts starts by deleting the folder yesterday and then moves the folder today to the folder yesterday. When... (4 Replies)
Discussion started by: ruben.rodrigues
4 Replies

7. HP-UX

fsck doesn't work - not even run?

Hi, please consider, I'm pretty new to HP-UX, thanks. Our server (rp7420 with HP-UX 11.31) has crashed due to disk write error (not boot partition). So I replaced damaged device with the new one of the same size and performed dd copy 1:1 to restore data - vxfs partition "/dev/vg01/lvol1"... (4 Replies)
Discussion started by: Morhoo
4 Replies

8. Shell Programming and Scripting

Script doesn't work as expected when run on cron

The script checks for free space stats on Oracle. If there are any tablespaces with more than 85% usage it prints the details of the tablespace. If all the tablespaces have more than 15% free space, then "All tablespaces have more than 15 pct free space" must be printed on the screen. When I run... (2 Replies)
Discussion started by: RoshniMehta
2 Replies

9. Shell Programming and Scripting

When things doesn't run into crontab???

Could someone explain my problem? I've the following script... #! /bin/ksh ... vmquery -m $MediaID | awk ' BEGIN {FS=": " getline expdate <"ExpDate.txt" } $1 ~ /media ID/ {MediaNumber = $NF} ... $1 ~ /number of mounts/ { "date +%Y"|getline YearToday Year4 = YearToday - 4 if... (4 Replies)
Discussion started by: nymus7
4 Replies
Login or Register to Ask a Question