Edit: the problem is the prune command,
your first folder, dir2, is a directory, so find stops
write a script like that:
or change the command to:
from the man page of find:
Quote:
-prune
Always evaluates to the value True. Stops the descent of the current path name if it is a directory. If the -depth flag is specified, the -prune flag is ignored.
How to stop the Prstat using shell script ?
because after i run the below script the thing seems to be always in loop and cannot get out till i ctrl + c, is there anything that i can add in the script to make it terminate ?
<code>
#!/bin/sh
prstat -Tc -u testing > testing.txt
</code>
... (19 Replies)
Hi,
I am writing a bash shell script. How can I tell it to stop. For example, I would like to have something similar to the following:
mike=1
if ; then
STOP THE SCRIPT
fi (3 Replies)
It is happening with my sessions already second time: a 'for'-loop for some reason stop to work as expected.
That means or it is looping without exitting, or it is not loop even once.
Here example of my try when it is not processing even one loop.
You can see, I start new subshell and... (14 Replies)
Hello,
I am ftping the file from one unix box to another box. This script works fine. Only problem here is, it is asking the password when ftp the file. How can i stop that. I am providing the password inside the shell script. But it is not accepting this. I need to put this script in crontab.... (5 Replies)
Hi All,
I would like to develop a shell script for stop & start an application server (1-4) on Solaris box. Here are the user requirements for this task.
1. User will input the option which server they wish to stop.
2. Will clear cache files from specific location.
3. ... (1 Reply)
Hi guys, I've found two nifty little scripts on these forums one which detects if the F5 key has been pressed:
#/bin/sh
_key()
{
local kp
ESC=$'\e'
_KEY=
read -d '' -sn1 _KEY
case $_KEY in
"$ESC")
while read -d '' -sn1 -t1 kp
do
_KEY=$_KEY$kp
... (0 Replies)
I have a AIX stop script file "stop_service_mail_DE_P" which is as follwoing
(
if
then
sleepforvalue=$(cat stopfileparam|grep sleepperiod|awk -F= '{print $2}')
targetdir=$(cat stopfileparam|grep targetdir|awk -F= '{print $2}')
touch $targetdir/stop_b2bgate_service_mail_de_p_p
sleep... (1 Reply)
Hi folks,
I am running a shell script it asks for username and password to stop some service, I need to write some script that it will read username and password from my shell script and then sucessfully stop services without prompting username/password query. (13 Replies)
Hi,
I need to create a shell script for automated server patching, with the following scenario:
I have two Linux servers Primary and secondary.
Server patching should start on Primary 1st and then secondary.
1st check both servers are up and running.
Then stop primary and patching will... (1 Reply)
I am writing a bash shell script for GarazLab's "WP EMAIL CRAWLER - AUTO SCRAPER & REAL TIME EXTRACTOR". it contains some commands. I want to stop the shell execution as soon as it encounters an error. how to do it? (8 Replies)
Discussion started by: tahsin352
8 Replies
LEARN ABOUT OSF1
alphasort
scandir(3) Library Functions Manual scandir(3)NAME
scandir, alphasort - Scans or sorts directory contents
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/types.h> #include <sys/dir.h>
int scandir ( char *dir_name, struct dirent * (*name_list[ ]), int (*select) ( struct dirent *dir ), int (*compare) (
struct dirent **dir1, struct dirent **dir2 ) );
int alphasort ( struct dirent **dir1, struct dirent **dir2 );
PARAMETERS
Points to the directory name. Points to the array of pointers to directory entries. Points to a user-supplied function that is called by
the scandir() function to select which entries to include in the array. Points to a user-supplied function that sorts the completed
array. Points to a dirent structure. Points to a dirent structure.
DESCRIPTION
The scandir() function reads the directory pointed to by the dir_name parameter. It then uses the malloc() function to create an array of
pointers to directory entries. The scandir() function returns the number of entries in the array and, through the name_list parameter, a
pointer to the array.
The select parameter points to a user-supplied function that the scandir() function calls to select which entries to include in the array.
The selection routine is passed a pointer to a directory entry and returns a nonzero value for a directory entry that is included in the
array. If the select parameter is a null value, all directory entries are included.
The compare parameter points to a user-supplied function that is passed to the qsort() function to sort the completed array. If the compare
parameter is a null value, the array is not sorted.
The memory allocated to the array can be deallocated by freeing each pointer in the array, and the array itself, with the free() function.
The alphasort() function alphabetically compares the two dirent structures pointed to by the dir1 and dir2 parameters. This function can be
passed as the compare parameter to either the scandir() function or the qsort() function. A user-supplied subroutine may also be used.
RETURN VALUES
The scandir() function returns -1 if the directory cannot be opened for reading or if the malloc() function cannot allocate enough memory
to hold all the data structures. If successful, the scandir() function returns the number of entries found.
The alphasort() function returns the following values: Less than 0 (zero): The dirent structure pointed to by the dir1 parameter is lexi-
cally less than the dirent structure pointed to by the dir2 parameter. 0 (zero): The dirent structures pointed to by the dir1 parameter
and the dir2 parameter are equal. Greater than 0 (zero): The dirent structure pointed to by the dir1 parameter is lexically greater than
the dirent structure pointed to by the dir2 parameter.
RELATED INFORMATION
Functions: malloc(3), opendir(3), qsort(3) delim off
scandir(3)