Script to create EVIM template with SAS extension


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to create EVIM template with SAS extension
# 1  
Old 11-15-2011
Script to create EVIM template with SAS extension

I write lots of SAS programs and would like to create a script that allows me to have a template each time I create a new program file.

Specs:
I use EVIM for my editor. I run SAS in batch mode. We use RedHat 6.
I don't use c shell.

I want a script that will do the following:

> scriptname newfilename

This then opens a file in EVIM editor entitled newfilename.sas. I want the file to also have a commented-out header box with my name, date, and some other things that I'll have to update each time.

I think this is probably pretty easy to do, but I'm stuck...new to shell scripting.

Thanks for any help.
# 2  
Old 11-15-2011
Code:
#!/bin/sh

if [ -e "$1" ]
then
        echo "$1 already exists" >&2
        exit 1
fi

if ! cp /path/to/template "$1"
then
        echo "Couldn't create $1 from template" >&2
        exit 1
fi

evim "$1"

# 3  
Old 11-15-2011
Thanks!
Another question.
What is the &2 in your code snippet?
# 4  
Old 11-15-2011
Redirects error messages into standard error where they belong.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash to create sub directories from specific file extension

In the bash below I am trying to create sub-directories inside a directory from files with specific .bam extensions. There may be more then one $RDIR ing the directory and the .bam file(s) are trimmed (removing the extension and IonCode_0000_) and the result is the folder name that is saved in... (2 Replies)
Discussion started by: cmccabe
2 Replies

2. Shell Programming and Scripting

Mainframe SAS JCL to Korn Shell script conversion

Hi All, Please help me to the conversion of Mainframe SAS JCL to korn Unix script. Please share the example from SAS JCL to Korn Unix Script. It be really helpful. Please share the online source also so I can look into it. Thanks, Abhishek (5 Replies)
Discussion started by: Abhishek Tyagi
5 Replies

3. Solaris

Can ufsdump create files that have a .vtoc and .dmp extension?

Hello, I was handed the job of restoring a drive on a old Sun Micro server running Solaris 8. The person who created the backup files told me I would need to use UFSrestore to restore the drive. I have read about everything on ufsrestore that is on this forum and have a decent grasp on how it... (18 Replies)
Discussion started by: CurtArnold
18 Replies

4. Shell Programming and Scripting

Bash/awk and for loop to create a template

Source File: google.cz http://czechrepublic.google.com/ http://czechrepublic.google.cz http://czechrepublic.google.com/ http://brno.google.cz http://brno.google.com/ Fail Code root@arisvm ~/g] $ cat trya rm -f ss for i in a.txt do #b=`cat $i|awk '{print $1}'` #c=`cat $i|awk '{print... (4 Replies)
Discussion started by: invinzin21
4 Replies

5. Red Hat

Create an unconfigured VMware host from a template that is set to do firstboot --reconfig

I have an Oracle Linux 7.1 vsphere host built. It's be preconfigured with our security configurations. What I would like to do is unconfigure this host. Then set the host to do firstboot --reconfigure. how do I do that using /etc/sysconfig/firstboot? I've tried setting ... (10 Replies)
Discussion started by: os2mac
10 Replies

6. Shell Programming and Scripting

Script to complete all fields of template

Hello gurus; I need to do a script to complete a technical template and I don't have idea to how to do :wall: I've try with bash and awk or sed but my brain is empty in this script. I need help please. The incoming file is a csv with an index number, first occurence in the possition of the... (2 Replies)
Discussion started by: renderuas
2 Replies

7. UNIX for Dummies Questions & Answers

How can a sas code be inscribed inside a cgi script?

Hi I have a question regarding how I can inscribe a sas code inside a cgi script? what will the output be?? Pls let me know.. Thanks, (1 Reply)
Discussion started by: swathi123
1 Replies

8. Programming

Perl script to create latex template.

Hi, I have XML file and I extracted some tags and stored in hash, my data as look like this $var1={ 'stud.xml'={ '24'=>'<address> <streetname="xxxx"/> <housenum="138"/"> ... (9 Replies)
Discussion started by: veerubiji
9 Replies

9. Homework & Coursework Questions

Create file and then change the extension case.

Interpreter should be bash. 1. The problem statement, all variables and given/known data: I need to make a file (myText.txt or song.mp3 or cloud.tar.gz or whatever) and then change the extension to (myText.TXT , song.MP3, cloud.TAR.GZ). It would be good if I can add all information in... (4 Replies)
Discussion started by: Kdenmen
4 Replies

10. Shell Programming and Scripting

create users from template

Create users from template file (0 Replies)
Discussion started by: rijeshpp
0 Replies
Login or Register to Ask a Question