Sponsored Content
Top Forums Shell Programming and Scripting how to find the path of a file when it is passed as ....filename(parameter) to script Post 302218061 by Vi-Curious on Thursday 24th of July 2008 08:01:17 AM
Old 07-24-2008
You need to write a script and the pwd command can be of use.

If you get the current working directory, you can recursively traverse the path and check for the existence of your file.

If pwd returns a/b/c/d/e/ then you check for the existence of a/b/c/d/file, a/b/c/file, etc until you find it.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

manipulate a passed in parameter

I am passing a file name as a parameter to shell script the parameter is getfile.txt.gpg how do i process this parameter to get name like getfile.txt only and eleminate the .gpg text?? Thanks in advance (2 Replies)
Discussion started by: rudoraj
2 Replies

2. UNIX for Dummies Questions & Answers

checking parameter values passed to script

Hi, I will pass 3 parameters for a script.I have to check the file name and create a new file name with time stamp. the parameters which i'm passing are /dir/stg/filename.txt /dir/path/head.txt /dir/path/tail.txt Now i have to check filename like : if it is a.txt i have to create... (2 Replies)
Discussion started by: ammu
2 Replies

3. Shell Programming and Scripting

Passing Filename as a Parameter to Another script

Hi, I have a requirement to write a script file(script1.sh) to read the file from the folder say /usr1/profiles/active and pass the file name as a parameter to another script file say (script2.sh) which would subsitute this parameter. The script2.sh will have a line like the one below ... (1 Reply)
Discussion started by: ravisg
1 Replies

4. Shell Programming and Scripting

Detecting Doublequotes(") When passed as parameter to shell script

Hi, I am executing a shell script which takes a string as a parameter. The scipt should validate the string and create the directoy with the name of specfied string. The following is the specified command and its parameter. test.sh "abc abc" The shell script is not able to identify... (4 Replies)
Discussion started by: raghu.amilineni
4 Replies

5. Shell Programming and Scripting

How can i passed a parameter to a file?

i got a file called Pass1, and then i need to passed a number to my script with the '-p pass_mark' option. Example type Pass1 -p 18 to pass 18 to my script for comparing things, so how can i do it? (7 Replies)
Discussion started by: mingming88
7 Replies

6. Shell Programming and Scripting

Incrementing the date depending on the Counter (parameter) passed to the script

Hello Everyone, I have been trying to complete a shell script where, I need to increment the date depending on the file (depending on the date) availability on the remote server. i.e. Basically, I will be passing a counter (like parameter 1 or 2 or 3 or 4). First I will check for the... (1 Reply)
Discussion started by: filter
1 Replies

7. Shell Programming and Scripting

Command that takes one parameter and then searches for the passed in parameter

Hi I am looking for a unix command or a small shell script which can takes one parameter and then searches for the passed in the parameter in any or all files under say /home/dev/ Can anyone please help me on this? (3 Replies)
Discussion started by: pankaj80
3 Replies

8. Shell Programming and Scripting

Shell script to find the sum of argument passed to the script

I want to make a script which takes the number of argument, add those argument and gives output to the user, but I am not getting through... Script that i am using is below : #!/bin/bash sum=0 for i in $@ do sum=$sum+$1 echo $sum shift done I am executing the script as... (3 Replies)
Discussion started by: mukulverma2408
3 Replies

9. Shell Programming and Scripting

Resolving a parameter which is passed as parameter

Hi, I have the following files. ->cat scr.sh export TMP_DIR=/home/user/folder1 export TMP_DIR_2=/home/user/folder2 while read line do cat "$line" done<file_list.dat ------------------------ -> cat file_list.dat $TMP_DIR/file1.txt $TMP_DIR_2/file2.txt --------------------------- -> cat... (6 Replies)
Discussion started by: barath
6 Replies

10. Shell Programming and Scripting

Shell script to find the wrong filename in a path and raise a trap for it

Example: I have server name A with an IP : 125.252.235.455 I have an username /password to login into this server under SSH connection In this server i have a path /apps/user/filename(Big.txt) Everyday we used to get the filename as Big.txt. I want a shell script to monitor this path... (4 Replies)
Discussion started by: ChandruBala73
4 Replies
GURU(8) 						      System Manager's Manual							   GURU(8)

NAME
guru - System administration SYNOPSIS
guru [ -e program ] [ -f ] [ -p target ] DESCRIPTION
guru is a sophisticated program synthesis and system maintenance tool developed after midnight in numerous university computing labs. It is based on the famous LISP Hacker system, used to develop AI programs on TENEX. guru reads a problem description from the standard input. An innovative and occasionally correct solution is generated and written to the standard output. Typically, guru is invoked repeatedly until an acceptable solution is generated or the user community has learned to live with the problem. The bugreport mechanism sometimes invokes guru. In this case guru executes at a priority inversely proportional to the reported urgency of the bug. Feature enhancements run at high priority whereas critical problems are fixed only when the machine would otherwise be idle. If the standard input is empty, guru uses its program synthesis capabilities to generate a selection of screen editors, X widgets, compil- ers, sundry games and the occasional diatribe. OPTIONS
-e program New features are added to an existing program. This option should be used with caution as the enhanced program may behave unpre- dictably or not at all. -f Reconstructs filesystems after a crash. -p target Ports the entire system on which guru is executing to target, preferably a RISC machine. This is an extremely time consuming oper- ation and is not guaranteed to terminate. If more than one option is specified, guru may thrash. Each copy of guru has its own set of unique, additional and undocumented options. SEE ALSO
YAPS: Yet another Program Synthesiser by S C Johnson. NOTES
Inherent design limitations prevent guru from synthesising comments. The programs generated are undocumented. The lucidity, politeness, relevance and language of the occasional diatribe vary considerably. The only diagnostic is an occasional ``I deserve a raise'' - which may be ignored albeit doing so may provoke ``I resign'' - an unrecover- able error. Sending the output of one guru into another can produce quite startling results. UNIX Programmer's Manual GURU(8)
All times are GMT -4. The time now is 07:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy