The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Predictive text input with Soothsayer iBot UNIX and Linux RSS News 0 05-14-2008 01:20 AM
Replace text in input file daphantomica Shell Programming and Scripting 2 04-25-2008 12:39 AM
combining two input text files d3ck_tm AIX 6 02-28-2006 08:23 PM
How to input username on text file into finger command on shell script Micz Shell Programming and Scripting 3 11-07-2005 11:38 PM
grep multiple text files in folder into 1 text file? coppertone UNIX for Dummies Questions & Answers 7 08-23-2002 11:50 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-15-2007
Registered User
 

Join Date: Dec 2007
Posts: 1
input text into file

hello everyone,

this is my first time posting here so be nice ;-)

I am a bit new at unix scripting and have basically been hacking other peoples scripts to get them to do what I need. I have now hit a bit of a stop. This problem is very basic but I can't just seem to figure out how to get around it.

And so to the problem. Basically I have an application that can interact with a unix prompt. at any one time it can send one command to the unix and return the output. What I need is to read a few lines of text into a file and for the prompt to return the file name for me. This file will be used at a later point so the file name must be random (pretty random). I was going to use the $$ as the file name. the life of this file will be short but if I use a fixed file name there is a chance it will be used by another process (running the same script at the same time).

so basically what I need help with is generating a script file that will take some text in (one or more lines various lenghts) place them in a file and return the file name.

If anyone could help me that would be great.

Regards

Cannon
Reply With Quote
Forum Sponsor
  #2  
Old 12-15-2007
Registered User
 

Join Date: Nov 2007
Posts: 18
i think the following will do

#!/bin/sh
MYFILE=$$
"run your command"> $MYFILE
echo "My new file is $MYFILE"

Last edited by Kundunni; 12-15-2007 at 07:49 AM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0