problem writing a simple c shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem writing a simple c shell script
# 1  
Old 05-05-2010
problem writing a simple c shell script

Code:
#!/bin/csh
echo hello world

this is what i got in a text file called ss1.
i type "chmod 755 ss1.txt" to make it executable.
then when i type
Code:
ss1

or
Code:
ss1.txt

it says
Code:
"ss1 command not found"

what am i doing wrong?

Last edited by Scott; 05-05-2010 at 02:46 PM.. Reason: Code tags please...
# 2  
Old 05-05-2010
Do you have the current directory (.) in the path (generally a bad idea)?

If not, you need to say

Code:
./ss1.txt

The script is either called ss1.txt (an odd name for a shell script), or ss1. Which is it? It can't be both!
# 3  
Old 05-05-2010
Quote:
Originally Posted by scottn
Do you have the current directory (.) in the path (generally a bad idea)?

If not, you need to say

Code:
./ss1.txt

The script is either called ss1.txt (an odd name for a shell script), or ss1. Which is it? It can't be both!
well the file's name is "ss1"
but it is a txt file.
# 4  
Old 05-05-2010
Quote:
Originally Posted by pantelis
well the file's name is "ss1"
but it is a txt file.
Gotcha Smilie

Then...

Code:
./ss1

# 5  
Old 05-05-2010
Quote:
Originally Posted by scottn
Gotcha Smilie

Then...

Code:
./ss1

ok! that's what i get.

"ss1: Command not found."
# 6  
Old 05-05-2010
Quote:
Originally Posted by pantelis
ok! that's what i get.

"ss1: Command not found."
Still?

Is csh in /bin?

Code:
which csh

# 7  
Old 05-05-2010
Try ls and see what the filename actually is...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script (simple problem)

I want to find and replace string from files present in one directory. user will input the string to be searched and to replace . Here is my program but Not working echo "Enter Old domain name:" read old echo "Enter New domain name:" read new grep -rl '$old' /var/www/ | xargs sed -i... (4 Replies)
Discussion started by: sunny2802
4 Replies

2. Shell Programming and Scripting

writing a simple script to get total number of cpus/cores in server

Hi, I am very new to scripting and I wanted to write a unix shell script which can give me, 1)number of cpu's in a box 2)number of cores per cpu 3)total number of cores in abox (ie multiplying 1&2) I am also trying to figure out how to check if hyper-threading is enabled in the... (8 Replies)
Discussion started by: steven12
8 Replies

3. Shell Programming and Scripting

Problem with writing into a file through shell script

Hi all, I have a shell script which I use to login to the server from the client and then from the server I run a bunch of other scripts to complete my task. I am having problems with the script below- #!/bin/bash while read line do connections=`echo $line | cut -d " " -f 1` period=`echo... (3 Replies)
Discussion started by: joydeep4u
3 Replies

4. Shell Programming and Scripting

Help with writing simple bash script

I want to write a bash script to: 1. Send an email from localhost to an external gmail account. (gmail then automatically forwards the message back to a pop account on the same server. 2. Script waits 3 minutes then checks to see if the email arrived, and if not, it sends an email to... (9 Replies)
Discussion started by: sallyanne
9 Replies

5. Shell Programming and Scripting

newbie: writing ksh shell problem

my default profile is using ksh, I tried to write a simple scripts and I had issues, below is my scripts: $ more if_num.ksh USAGE="usage: if_num.ksh" print -n "Enter two numbers: " read x y if ((x=y)) then print "You entered the same number twice." when I tried to executed the... (6 Replies)
Discussion started by: matthew00
6 Replies

6. Shell Programming and Scripting

Problem with IF - CAT - GREP in simple shell script

Hi all, Here is my requirement I have to search 'ORA' word in out.log file,if it is present then i need to send that file (out.log) content to some mail id.If 'ORA' word is not in that file then i need to send 'load succesful' message to some mail id. The below the shell script is not... (5 Replies)
Discussion started by: mak_boop
5 Replies

7. Shell Programming and Scripting

one simple shell script problem

Hi everyone, I am facing to one shell script problem, which is as following Write a shell script that: Takes a number of arguments. For each argument, print out all files in the current directory that contain this substring in their name. I know I need to use grep for the second... (7 Replies)
Discussion started by: shaloovia
7 Replies

8. UNIX for Dummies Questions & Answers

HELP! writing simple shell script

how would i write a shell script to show the number of lines in which int variable appears in a c++ program. (3 Replies)
Discussion started by: deadleg
3 Replies

9. UNIX for Dummies Questions & Answers

simple shell script problem

hi all. i have a little problem. im basically reading input from the user from the keyboard into the variable "phonenumber". I want to do a little error check to check if the user doesnt enter anything in for the value phonenumber. i had this: read phonenumber if then ..... else ........ (2 Replies)
Discussion started by: djt0506
2 Replies

10. UNIX for Dummies Questions & Answers

Need help writing simple script

I'm trying to write a simple unix script that will delete files after 30 days of being created. I've never done this before but conceptually it sounds easy. Here is what I'm trying to do: Get System Date Get File Date If (sysdate-filedate>30days) rm file All of these files are contained... (1 Reply)
Discussion started by: tamdoankc
1 Replies
Login or Register to Ask a Question