Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help-prompt for path and take this as input in find command Post 302155131 by bsandeep_80 on Thursday 3rd of January 2008 03:40:59 AM
Old 01-03-2008
Hi ,

i created a sheel script with what you had specified and then ran it as sandeep.sh as below

This does not work...it gives me error as follows:

[root@bon05 EA]# sandeep.sh
-bash: sandeep.sh: command not found


************************************************
##!/usr/bin/sh -x

read dir?"what is the path that you want to find ?" > /EA/sandeep.log

find $dir -ctime +200 -type f -exec ls -l {} \; >> /EA/sandeep.log

*****************************************************


Please help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to prompt for input & accept input in ONE line

hi, am a new learner to shell programming. i have a script which will prompt for user to key in their name & display their name afterwards. script ===== echo "Pls enter your name:" read name echo "Your name is $name." output ===== Pls enter your name: Bob Your name is Bob. what... (2 Replies)
Discussion started by: newbie168
2 Replies

2. UNIX for Dummies Questions & Answers

command to find the path of a file

What is the command to find the path of a file if we know the file name and the root directory where the file resides.. For eg. if a file abc.dat resides in /home/mydir/myfiles/. I am looking for a command which will be fired from / directory, takes abc.dat as input and display the path of... (3 Replies)
Discussion started by: abhilashnair
3 Replies

3. UNIX for Dummies Questions & Answers

create PATH from find command output

I'm trying to autogenerate a PATH variable from the output of a find command as follows: PATH=`find $dir -name "*.jar" | sed 's/$/:/'` The output looks similar like this if I echo it: PATH=/path/to/1.jar: /path/to/2.jar: /path/to/3.jar: I want the path to be on one line. I'm on... (3 Replies)
Discussion started by: rein
3 Replies

4. UNIX for Dummies Questions & Answers

problem with output of find command being input to basename command...

Hi, I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script. I am planning to do like this: if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies

5. AIX

How to find the status of SAN Disc through command prompt

How to find the status of SAN Disc through command prompt (1 Reply)
Discussion started by: AIXlearner
1 Replies

6. UNIX for Dummies Questions & Answers

command to find the absolute path

i understand by using the pwd command we get the present working directory. which command is used to find absolute path from home directory to root.. What is absolute path to your and root user's home directory.:confused::confused::confused: (2 Replies)
Discussion started by: shaziafathima
2 Replies

7. UNIX for Advanced & Expert Users

Entire Input command not visible in Unix prompt

Hi, While typing the Unix command, entire command is not visible.When the input command is long, it is not visible. I want the entire command to be displayed when i type it. Please help to resolve this issue. Thanks Sampath (7 Replies)
Discussion started by: sampath.giri
7 Replies

8. Shell Programming and Scripting

Is it possible to prompt for input if not given on command line?

I have a script built that takes the standard inputs $1 $2 $3 after the name and parses some data. hexsite=`echo "obase=16;$1"|bc` hexfix=$(printf "%.3X" 0x$hexsite) if || ;then type=33 elif || ;then type=59 elif ;then type=99 else type=00 fi cat /directory/*.2012$3*| I am... (8 Replies)
Discussion started by: PCGameGuy
8 Replies

9. Red Hat

How to find the path of a command?

Hi guys. I want to know the path of a command. I tried "which" command also . But no luck. Please tell me how to find and update the correct path of the command. Here I'm unable to find the path of ext2online command # resize2fs /dev/vg01/lvora_backup resize2fs 1.39 (29-May-2006)... (3 Replies)
Discussion started by: vamshigvk475
3 Replies

10. Red Hat

Find command to exclude a specific path

Hi Folks, I want to run the below command and to exclude the specific path like /var/test/support/... . How to achieve using the below command find / -type f \( –perm –4000 –o –perm –2000 \) –print -Siva Please do not use FONT tags inside CODE tags. And, there is usually no reason to... (2 Replies)
Discussion started by: gsiva
2 Replies
GETOPTS(3)						  libbash getopts Library Manual						GETOPTS(3)

NAME
getopts -- libbash library for command line parameters parsing SYNOPSIS
$retval getopt_long <Instructions> <Parameters> DESCRIPTION
This is a documentation for libbash getopts library, that implements getopt_long function for bash(1). For documentation of bash getopts function, please see getopts(1) ( getopts(1posix) on some systems). Here is a table for reference: getopts(1) (or 1posix on some systems) implemented by bash getopts(3) implemented by libbash. getopt(1) implemented by getopt utils (part of util-linux) getopt_long(1) implemented by libbash and installed to section 1 instead of 3 to prevent collision with C man pages. getopt(3) implemented by GNU C library. getopt_long(3) implemented by GNU C library. I have also seen separate getopt utility which part of util-linux package. The getopt_long function parses the command line arguments. It uses Instructions as the rules for parsing the Parameters. The Instructions A string that specifies rules for parameters parsing. The instructions string is built of a group of independent instructions, separated by a white space. Each instruction must have the following structure: -<SingleLetter>|--<MultiLetter>-><VariableName>[:] This structure contains three parts: -<SingleLetter> This is the parameter single-letter sign. For example -h. --<MultiLetter> This is the parameter's corresponding multi-letter sign. For example --help. <VariableName>[:] This is the name of the variable that will contain the parameter value. For example: HELP. The Variable name can represent one of two variables types: Flag variable (not followed by ':') In this case, it will hold the value 1 if 'on' (i.e. was specified on command line) and will not be defined if 'off'. Value variable (followed by ':') In this case, the value it will hold is the string that was given as the next parameter in the Parameters string (Separated by white-space or '=' ). If input contains more then one instance of the considered command line option, an array of the given parameters will be set as the value of the variable. The Parameters The Parameters are simply the parameters you wish to parse. RETURN VALUE
This function returns a string that contains a set of variables definitions. In order to define the variables, this string should be given as a parameter to eval function. This value is returned in the variable $retval. EXAMPLES
Parse command line parameters looking for the flags -h | --help and -v | --version and for the value -p | --path : getopt_long '-h|--help->HELP -v|--version->VERSION -p|--path->PATH:' $* eval $retval In this example, for the parameters --help --path=/usr/ the variables that will be created are: HELP=1 PATH=/usr/ for the parameters --help --path=/usr --path=/bin the variables that will be created are: HELP=1 PATH=(/usr /bin) BUGS
Values must not contain the string `__getopts__'. This string will be parsed as a single white-space. A value should not start with an already defined multi-letter sign. If such a value exists, it will be treated as the equivalent singe-letter sign. This bug only accures when using a single-letter sign, or a multi-letter sign that are not followed by a `='. For example: If we have a script named `foo', and we parse the parameters `-d|--dir:' and `-f|--file:', then foo -d --file and foo --dir --file will not work foo --dir=--file will work. AUTHORS
Hai Zaar <haizaar@haizaar.com> Gil Ran <gil@ran4.net> SEE ALSO
ldbash(1), getopt_long(1), getopts(1), getopt(1), libbash(1), getopt(3), getopt_long(3) Linux Epoch Linux
All times are GMT -4. The time now is 08:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy