BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

Hello everyone,

 

I have a shell script in unix whose name is : batching.csh

Here is the code inside this file:

 

#!/bin/ksh
cd /Program_Directory/
sas prog_1.sas &

 

My problem is when I run this script it told me "Command not found"

 

             xnzspap23x-tcsh-23$ batching.csh
             batching.csh: Command not found.

This is my first time create a shell script in unix, please help me!

 

Thank you!

5 REPLIES 5
Reeza
Super User

First figure out the command line that you need directly in Unix. 

Then you incorporate those into a sh file that you call from Unix and test

Then you test it in SAS. 

 

Which step are you on now?

GeorgeSAS
Lapis Lazuli | Level 10
I found the problem is I use notepad to edit the .csh file. when I use vi to create this file it works.
but vi is very not convenient to edit like notepad. any suggestion?
Reeza
Super User

When you save it make sure it gets saved with the .sh extension and doesn't get named filename.sh.txt or something of the sort.

Kurt_Bremser
Super User

I would not use something as crude as Windows Notepad for programming work (which inlcudes shell scripting).

Actually, I still use vi for scripts

- is available on ALL UNIX platforms with the same syntax

- works even over a simple telnet connection, as it does not need any function keys/mousing around/etc

- can edit files of arbitrary size, although it might change to line mode with sufficiently large files.

 

If you are working on UNIX from Windows, I recommend using notepad++, as it can write text files in UNIX mode (LF instead of CRLF), provides a hex display mode, and lots of other features that are helpful when writing any type of code.

Kurt_Bremser
Super User
If the directory where your script is stored is not in the PATH environment variable, you need to supply the whole path for the command. Or at least ./ for the current directory.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2371 views
  • 3 likes
  • 3 in conversation