Sponsored Content
Top Forums Shell Programming and Scripting Accepting filename as command line param and writing to it Post 302164916 by silas.john on Wednesday 6th of February 2008 07:53:08 AM
Old 02-06-2008
Quote:
Originally Posted by manas_ranjan
i would suggest trying to solve a problem is good.....but after then rectification is also required....so can u please look below my suggestions and try to check why u r solution is having problem...??? can u do it...


File_Name=$1
Path="/xx/yy"

echo " Welcome....." >> $Path/$File_Name
i guess ur code doesn work either..says ksh [programfilename] cannot execute
 

10 More Discussions You Might Find Interesting

1. HP-UX

find command using -mmin param

Hi Everyone, I would like to know how to find a file which was created in the period of 20+ hours, in most common unix OS, the parameter -mmin is not supported (i.e, HP-UX, Solaris, LInux, AIX) Could you help on this ?? (3 Replies)
Discussion started by: jmbeltran
3 Replies

2. Shell Programming and Scripting

Command param subst to reg expression

I want to find out Row which starts with, the user specified details to a script. In general I know what command to be given. awk '$0~/^Vi/' BReject But I need to pass on $1 param of command line at the place of 'Vi'. I tried with -v subst=$1 awk -v subst=$1 '$0~/^subst/' BReject But it... (5 Replies)
Discussion started by: videsh77
5 Replies

3. UNIX for Advanced & Expert Users

Reading a file and writing the file name to a param file.

Hi All, Not sure if this would be in a dummies sectiin or advanced. I'm looking for a script if someone has doen something like this. I have list of files - adc_earnedpoints.20070630.txt adc_earnedpoints.20070707.txt adc_earnedpoints.20070714.txt adc_earnedpoints.20070721.txt... (1 Reply)
Discussion started by: thebeginer
1 Replies

4. Shell Programming and Scripting

writing into one line

hi i have a file contains data Line timeout: START->SIGNON_REPLY, SIGNON_REPLY->SIGNON, Received SOT req SOT request: SIGNON->SOT_REPLY, SOT_REPLY->DATA_RECEIVE, DATA_RECEIVE->EOD, i need to write into one line , separated by commas please help thanks Satya (2 Replies)
Discussion started by: Satyak
2 Replies

5. Shell Programming and Scripting

Change filename extensions..from command line

I want to change the extensions of a folder full of files (some of the files are located in subfolders as well) to another extension, but instead of replacing the files I want the new files to be copied into a newly created folder. Here is the folder structure: /Downloads/3eb... (3 Replies)
Discussion started by: bound4h
3 Replies

6. Shell Programming and Scripting

grep not accepting variable filename

I have a very basic shell script right now, and I am trying to run grep from inside of it. It looks like this: #!/bin/sh filename=$1 echo "The program that you will be editing is called $filename" grep "//" $filename The name of said file is "myscript" for right now. I am executing it on... (1 Reply)
Discussion started by: bdrelling
1 Replies

7. Shell Programming and Scripting

Preserving newlines when writing loops on the command line in bash

Dear All, I have a question that's been difficult to get an answer to. I often write command line loops, e.g. find files, print name, grep for term, apply sed, etc I use both zsh and bash. When I write a loop e.g. for line in `more myfile.txt` > do > echo $line > done but... (2 Replies)
Discussion started by: JohnK1
2 Replies

8. UNIX for Dummies Questions & Answers

Accepting command line arguments in bash

I have this tcsh code that I want to convert to a bash script. Basically it accepts command line arguments supplied by the user and stores them, so they can be used to run a C++ program. set arg_browseDir_inFileLst = "" set allArgsUpCase = `echo "$*" | tr '' ''` set opt_browseDir_flag =... (17 Replies)
Discussion started by: kristinu
17 Replies

9. Shell Programming and Scripting

How to pass a filename as a command line argument

Hi,I have a script which is given below :#!/bin/bash. ini_script.shdb2 connect to $DB_NAME user $DB2_UID using $DB2_PASSWORDfor file in `ls -1 ./sql/ddw/`do echo "Executing the file $file" echo db2 -tvf $filedonedb2 quiti want this script to accept directorie's names present in... (1 Reply)
Discussion started by: ektubbe
1 Replies

10. Shell Programming and Scripting

sed command not accepting variable in shell script

I am using a shell script in fedora linux. While calling to the shell I am also passing an argument (var1=0.77) like shown below sh gossip.sh var1=0.77 in the shell following command is written (which doesn't work) sed - i -e 's@prob=@prob="$var1";//@g' file.txt Actually i want the... (7 Replies)
Discussion started by: Fakhar Hassan
7 Replies
Path::Class::File::Stat(3pm)				User Contributed Perl Documentation			      Path::Class::File::Stat(3pm)

NAME
Path::Class::File::Stat - cache and compare stat() calls on a Path::Class::File object SYNOPSIS
use Path::Class::File::Stat; my $file = Path::Class::File::Stat->new('path','to','file'); # $file has all the magic of Path::Class::File # sometime later if ($file->changed) { # do something provocative } DESCRIPTION
Path::Class::File::Stat is a simple extension of Path::Class::File. Path::Class::File::Stat is useful in long-running programs (as under mod_perl) where you might have a file handle opened and want to check if the underlying file has changed. METHODS
Path::Class::File::Stat extends Path::Class::File objects in the following ways. use_md5 Calling this method will attempt to load Digest::MD5 and use that instead of stat() for creating file signatures. This is similar to how File::Modified works. changed Returns the previously cached File::stat object if the file's device number and inode number have changed, or if the modification time or size has changed. Returns 0 (false) otherwise. While File::Modified uses a MD5 signature of the stat() of a file to determine if the file has changed, changed() uses a simpler (and probably more naive) algorithm. If you need a more sophisticated way of determining if a file has changed, use the restat() method and compare the cached File::stat object it returns with the current File::stat object. Example of your own changed() logic: my $oldstat = $file->restat; my $newstat = $file->stat; # compare $oldstat and $newstat any way you like Or just use File::Modified instead. restat Re-cache the File::stat object in the Path::Class::File::Stat object. Returns the previously cached File::stat object. The changed() method calls this method internally if changed() is going to return true. SEE ALSO
Path::Class, Path::Class::File, File::Signature, File::Modified AUTHOR
Peter Karman, <karman@cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2006 by Peter Karman This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-28 Path::Class::File::Stat(3pm)
All times are GMT -4. The time now is 01:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy