The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
insertion sort??? sogpop UNIX for Dummies Questions & Answers 2 04-16-2008 10:20 PM
Reading the header of a tar file(posix header) Tanvirk Linux 2 01-31-2008 08:50 AM
Remove & insertion of data in a same file videsh77 Shell Programming and Scripting 10 03-01-2007 06:27 AM
problem with Unicode characters insertion suman_jakkula AIX 0 02-11-2006 01:20 AM
Insertion of Leap Second isingh786 UNIX for Advanced & Expert Users 2 12-28-2005 02:05 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-21-2006
olimiles olimiles is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 18
automatic header insertion

hi
Is there any way to automatically insert a predefined header into a file?
It would include the file name, author name, date and a description, the description entered on the first line of vi.

Thanks for any help

Oliver
  #2 (permalink)  
Old 08-21-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
Do you mean while you are in vi?
  #3 (permalink)  
Old 08-21-2006
olimiles olimiles is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 18
Hi jim
Thanks for the interest, it was when starting a new file in vi to automatically insert the header, but i worked it out.

Thanks though

Oliver
  #4 (permalink)  
Old 08-21-2006
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 188
Olimiles,

Can you let me know how you acheived it?
  #5 (permalink)  
Old 08-22-2006
olimiles olimiles is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 18
No problem!

Code:
#!/bin/bash
AUTHOR=`grep $USER /etc/passwd | cut -d":" -f5`
DATE=`date '+%Y/%m/%d'`
read DESCRIPTION
cat << END
#!/bin/sh
####################################
## Program      : $1
## Author       : $AUTHOR
## Date         : $DATE
## Description  : $DESCRIPTION
###################################
END
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0