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
Predictive text input with Soothsayer iBot UNIX and Linux RSS News 0 05-14-2008 04:20 AM
Replace text in input file daphantomica Shell Programming and Scripting 2 04-25-2008 03:39 AM
combining two input text files d3ck_tm AIX 6 02-28-2006 11:23 PM
How to input username on text file into finger command on shell script Micz Shell Programming and Scripting 3 11-08-2005 02:38 AM
grep multiple text files in folder into 1 text file? coppertone UNIX for Dummies Questions & Answers 7 08-23-2002 02:50 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-15-2007
cannonfodder cannonfodder is offline
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
  #2 (permalink)  
Old 12-15-2007
Kundunni Kundunni is offline
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 10:49 AM..
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 07:58 AM.


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