04-01-2015
No, j is a variable.
The whole outer loop is fed from searchstring.out, see the redirection at the end!
The inner loop is fed from the find command. The | conects the find command with the loop.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a script that has the following command:
find /home/user -name test.dat
The script works as desired when running normally. However, when I run the script preceding it with 'sh', it fails. Is there something I need to account for when preceding the execution of the script with 'sh'? (1 Reply)
Discussion started by: bsavitch
1 Replies
2. Shell Programming and Scripting
I am running shell scripts on windows using Cygwin tool.
In my shell scripts, i want to add an error check, that verify whether a certain command is available or not.
For example if SED comamnd is not available in Cygwin, then it should exit with error message.
How do i write such shell... (2 Replies)
Discussion started by: mmunir
2 Replies
3. Shell Programming and Scripting
Hi all does find command return anything if the file to be searched is not found? Like if I search from a file in a dir does it return false or null if the file is not found? Please suggests. (3 Replies)
Discussion started by: Veenak15
3 Replies
4. Solaris
I have a sun4u system running Solaris 8. I tried running the df command but it returns a blank result. Also I'm unable to collect an explorer from this system as the OS complains that the disk is full. What could be going on here? (10 Replies)
Discussion started by: dperry1973
10 Replies
5. Shell Programming and Scripting
Hello
I have a script which emails identifies the user ID of a user and sends them an email. A user can enter part of the name of the person he/wants to send the email to. Then I use the ypcat command to identify the UID of that person.
The problem I'm having, is building in an error trap... (1 Reply)
Discussion started by: Glyn_Mo
1 Replies
6. Shell Programming and Scripting
hi
I am a newbee in Shell scripting (hardly 7 days)
I have to execute a shell script which looks like this
#!/bin/sh
var1=`date +"%Y%m%d"`
echo $var1
find . -name "$var1*" -exec mv {} Delete/ \;
the find command in the script is running independently but when kept in this script it is... (24 Replies)
Discussion started by: sweetnsourabh
24 Replies
7. UNIX for Dummies Questions & Answers
Hello all,
Something strange going on with a shell script I'm writing. It's trying to write a list of files that it finds in a given directory to another file. But I also have a skip list so matching files that are in that skip list should be, well uhm, skipped :)
Here's the code of my... (2 Replies)
Discussion started by: StijnV
2 Replies
8. Shell Programming and Scripting
Hi all,
Please i need an explanation for the following statements
ref_file=/tmp/cleanfiles export ref_file
touch `TZ=WAT+2 date "+%Y%m%d%H%M"` $ref_file
find . ! -name . -prune -type f ! -newer $ref_file -exec store_file.sh {} \; (1 Reply)
Discussion started by: anish_1982
1 Replies
9. Shell Programming and Scripting
Hi,
Can anyone help me how to exit a shell script if a unix command inside does not return any value for 10 seconds?
The scenarios is like this.
I want to login to a application using shell script where the connection string is mentioned.but suppose this connection string is not... (10 Replies)
Discussion started by: arijitsaha
10 Replies
10. SuSE
Hi,
I am using below code snippet to echo/display the files found
(matching a pattern from searchstring.out file) and the corresponding owner.
while read j
do
echo "Pattern to search is:- $j"
find / -name "*$j*" |\
while read k
do
echo "File found is:- $k"
owner=$(ls... (9 Replies)
Discussion started by: Vipin Batra
9 Replies
LEARN ABOUT SUNOS
hashstat
hash(1) User Commands hash(1)
NAME
hash, rehash, unhash, hashstat - evaluate the internal hash table of the contents of directories
SYNOPSIS
/usr/bin/hash [utility]
/usr/bin/hash [-r]
sh
hash [-r] [name...]
csh
rehash
unhash
hashstat
ksh
hash [name...]
hash [-r]
DESCRIPTION
/usr/bin/hash
The /usr/bin/hash utility affects the way the current shell environment remembers the locations of utilities found. Depending on the argu-
ments specified, it adds utility locations to its list of remembered locations or it purges the contents of the list. When no arguments are
specified, it reports on the contents of the list. The -r option causes the shell to forget all remembered locations.
Utilities provided as built-ins to the shell are not reported by hash.
sh
For each name, the location in the search path of the command specified by name is determined and remembered by the shell. The -r option to
the hash built-in causes the shell to forget all remembered locations. If no arguments are given, hash provides information about remem-
bered commands. The Hits column of output is the number of times a command has been invoked by the shell process. The Cost column of output
is a measure of the work required to locate a command in the search path. If a command is found in a "relative" directory in the search
path, after changing to that directory, the stored location of that command is recalculated. Commands for which this will be done are indi-
cated by an asterisk (*) adjacent to the Hits information. Cost will be incremented when the recalculation is done.
csh
rehash recomputes the internal hash table of the contents of directories listed in the path environmental variable to account for new com-
mands added.
unhash disables the internal hash table.
hashstat prints a statistics line indicating how effective the internal hash table has been at locating commands (and avoiding execs). An
exec is attempted for each component of the path where the hash function indicates a possible hit and in each component that does not begin
with a '/'.
ksh
For each name, the location in the search path of the command specified by name is determined and remembered by the shell. The -r option to
the hash built-in causes the shell to forget all remembered locations. If no arguments are given, hash provides information about remem-
bered commands.
OPERANDS
The following operand is supported by hash:
utility The name of a utility to be searched for and added to the list of remembered locations.
OUTPUT
The standard output of hash is used when no arguments are specified. Its format is unspecified, but includes the pathname of each utility
in the list of remembered locations for the current shell environment. This list consists of those utilities named in previous hash invoca-
tions that have been invoked, and may contain those invoked and found through the normal command search process.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of hash: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
PATH Determine the location of utility.
EXIT STATUS
The following exit values are returned by hash:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), ksh(1), sh(1), attributes(5), environ(5), standards(5)
SunOS 5.10 17 Jul 2002 hash(1)