Newb scripting question, I get the error script not found


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Newb scripting question, I get the error script not found
# 1  
Old 05-03-2006
Newb scripting question, I get the error script not found

This is probably a really simple problem, but goes easy on me I'm still a newb. The problem I have is that a script (we'll call it script.script) I edited won't run for some reason, I get the error "ksh: script.script: not found"


The location of my script is as follows: /home/users/arkitech

The actual script I'm running looks like this:
[q]
#!/bin/perl -w
#
##########################################################################
# NAME: script.script
# SYNOPSIS: script provides daily monitoring of system activity &
# disk usage
##########################################################################
# DECLARE VARIABLES
use strict;

companyservername:/home/users/arkitech-> whence sendmail /usr/sbin/sendmail

my @sar = qx(/bin/sar);
my @space = qx(/bin/df -k /dev/vx/dsk/elephant_fs/p1* | grep -v "Filesystem");
my $to = 'arkitech@att.com'; #
my $from = 'companyaddress@msg.ameritech.com';
my $date = scalar(localtime);
my $fs;
my $newfs;
my $kbytes;
my $used;
my $avail;
my $capacity;
my $mounted;

open(SENDMAIL, "|/usr/lib/sendmail -t ") or die ("Can't fork for sendmail daemon: $!\n");

print SENDMAIL "From: <",$from,">\n";
print SENDMAIL "To: ",$to,"\n";
print SENDMAIL "Subject: ODR daily capacity monitor\n";
print SENDMAIL "Reporting on ", $date, "\n\n";
print SENDMAIL "System Activity\n";
print SENDMAIL "-----------------\n";
print SENDMAIL @sar, "\n\n\n";
print SENDMAIL "Disk Usage\n";
print SENDMAIL "------------\n\n";
print SENDMAIL "Filesystem \t\tkbytes \tused \tAvailable\tcapacity\t Mounted on\n";
print SENDMAIL "------------------\t----------\t---------\t---------\t--------\t -------------------\n";

format SENDMAIL =
@<<<<<<<<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<<<<<<<<<<<
$newfs, $kbytes, $used, $avail, $capacity, $mounted
.

foreach (@space) {
chomp;
($fs, $kbytes, $used, $avail, $capacity, $mounted) = split(/\s+/, $_);
$newfs = substr($fs, 24);
write SENDMAIL;
}

print SENDMAIL "\n\nEnd of Report.\n\n";

close(SENDMAIL) or warn ("sendmail didn't close nicely! $!\n");
[/q]

Thanks for any help
# 2  
Old 05-03-2006
My guess is that it can't find perl.

Do a 'which perl' and make sure you have the correct path listed in your script. It's normally not in /bin. It should be in /usr/bin or maybe even /opt.

-X
# 3  
Old 05-03-2006
Quote:
Originally Posted by Arkitech
I get the error "ksh: script.script: not found"
When you start a script that's in the current workingdirectory, use ./script.script to start it. Just typing its name will not work, unless you put your current directory (specified by a single dot) in $PATH (which is generally a bad idea).

As an example, a simple script which just says "Hi".
Quote:
[roy@tatanka] roy $./scr
Hi
[roy@tatanka] roy $scr
-bash: scr: command not found
[roy@tatanka] roy $
Look familiar?
# 4  
Old 05-04-2006
Thanks Indo, that's exactly what the problem was. I attempted to run the script using just the file name.

Thanks again for the help
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

+: not found Error in shell script

Hi , I am a newbie to shell scripting. I am getting the error on AIX machine /tadfdc_setup_fed.sh: +: not found Here tadfdc_setup_fed.sh is script which works fine on Linux Machine. But gives error on AIX (1 Reply)
Discussion started by: Anupam Kakade
1 Replies

2. UNIX for Dummies Questions & Answers

NEWB Question - BASH COMMAND RESULT for ${0##*/}

This should be extremely simple and someone will probably answer it in .5 seconds. I need to know what: VARIABLE=${0##*/} does? I do not have a shell handy to just try it in. I am reading through some scripts and need to understand this line. Any help is appreciated. Many thanks! -... (3 Replies)
Discussion started by: chrisgoetz
3 Replies

3. Shell Programming and Scripting

Newb question about getting a word from a text file

Hi everyone. I am new to shell scripting and have been looking at quite a few web pages to try and figure this out, but to no avail. What I am trying to do is get a value from a text file that contains a paragraph of information.. Something similar too: Welcome to random script You are... (1 Reply)
Discussion started by: elemenopee
1 Replies

4. Shell Programming and Scripting

newb at scripting how would I do this?

Hi guys. I have been lurking for quit some time attempting to learn on my own but I have reached an impasse. I need to extract specific details from from a text file that I get and parse it out into separate files with the name of each individual and the date it was proccess. Then within... (2 Replies)
Discussion started by: lostpacket
2 Replies

5. UNIX for Dummies Questions & Answers

Newb writing his first shell script

Hey! This is my first post on this forum, nice to meet ya! I've been using Linux for a good few years, I grew up using DOS and a few similar CLI-based OS's so I'm fairly okay with navigating my way around the terminal. Recently I decided I wanted to become a sysadmin so I've been teaching... (3 Replies)
Discussion started by: Tamachan87
3 Replies

6. Shell Programming and Scripting

getting the error 'not found' while executing the script

Hi, I am not able to figure out what the problem is: getting the following error sqltst.sh: 1: not found here is the script #!/bin/sh . /home/dev1/.profile . /home/dev1/.infenv `sqlplus -s $REPDB_LOGON << EOF SET SERVEROUT ON SET FEEDBACK OFF SET HEADING OFF SET TRIMSPOOL... (4 Replies)
Discussion started by: svajhala
4 Replies

7. Shell Programming and Scripting

Newb with While loop question

My first post here.... I have a few years exp with linux distros and some very basic Python..Ive been intent on learning shell scripting the last few weeks. Please excuse my crude efforts. I am running a program that takes network data containing US city names in plain text. I am TRYING to... (7 Replies)
Discussion started by: dddkkk
7 Replies

8. Shell Programming and Scripting

Another newb question: how to use test for zero-length string ?

Assume $x equals "". If I try: if test -n $x I get the "Expression syntax" error. It works in Linux but not in unix bash. In unix bourne I get "test: argument expected" (4 Replies)
Discussion started by: lumix
4 Replies

9. UNIX for Dummies Questions & Answers

Newb question

I don't even know if this should go here but I just would like to know what this means: d0e45878043844ffc41aac437e86b602 I know absolutely nothin' about UNIX, and I found this in a SQL table in a board I run. Someone please tell me what that is in "normal" mode. Pardon me for my... (4 Replies)
Discussion started by: daeglin
4 Replies

10. Shell Programming and Scripting

newb shell question

I know this is a total begginer question but what is wrong with this picture. My loop wont loop, it just drops me back to the prompt and gives the error "unary operator expected". Any help would be appreciated. here it is, #!/bin/sh selection= while do cat << MENU 1)List files in... (2 Replies)
Discussion started by: Fokus
2 Replies
Login or Register to Ask a Question