I want the script to read the directory I am running the script from and print the contents of any file that has GX in it's title. This is the code needed[I think]. But how do I combine it?
Hi,
I need some assistance with comparing 2 diff application. The format of the first file is in TAR "filename.1.2.3.tar" . The second file is a running application for which i need to find the version and then prompt the user for action as below :-
Once compared, It needs to prompt the user,... (0 Replies)
What one finds challenging another finds simple...
(HPUX B.11.11)
I have a text file named something like 12345.dst that could look like this:
DOG
CAT
NONE
TEST
CAT
What I want to end up with is 12345.dst looking like this:
CAT
DOG
TEST
removing "NONE" should it be there and... (1 Reply)
Hello,
I have a script that monitors files uploaded via ftp. After a successful upload, the file name is written to the pipe.
There is another program that reads this pipe and allows automatically run any program or script ( say test.sh ) to process the newly uploaded file.
cat test.sh... (2 Replies)
This is my task - pls help
Write a script that will run every 5 min and check if a particular file has appeared in a particular directory. Once it appears then rename the file and move it a bkp directory and run another script. (3 Replies)
shell: #!/bin/ash
I searched and found a few relevant posts (here and here - both by porter, on the same day (?)) however both are just a do while loop, I need to check a file date and compare it to the current time.
I would like it to say if file 'test' is more than 12 hours old than "right... (3 Replies)
hi,
i have a service on unix platform, it will generate traces in a particular folder
i want to check using shell script if traces exist, then perform some action else continue to be in loop.
filename is service.tra
can you please help?
thanks (4 Replies)
Hi,
Is the below possible (SHELL = tcsh)?
-- I want to write an 'alias' something like this -
alias set_my_work "setenv SOME_VAR;tcsh -i;source work_script.cshrc"
The intention is to run this alias and enter a child shell, at the same time ensuring that the work_script.cshrc is source-ed.... (0 Replies)
Dear All,
this is my first post on this Forum, glad to be here.
I'm trying to fix an .ods file. Yes, I had a backup, but it's also corrupted.
When opening the document I get this EM:
read error
format error discovered in the file in sub-document content.xml at
2,337040(row,col).
So I... (3 Replies)
Hi friends,
In my shell script, I want to open a file using vi editor. After opening the file in vi, I want to save and quit this file automatically.... all through shell script.
the code segment is:
------------------------------------------------------------
cd ~/netfpga/projects/scone/sw/... (2 Replies)
Have some files in /tmp/dir
abc.zip
123.zip
345.zip
and if name matches to 345.zip then take action
My code....
am i doing something wrong ? Please advise.
#!/bin/bash
set -x
cd /tmp/dir
for i in *.*
do
if ]
then (4 Replies)
Discussion started by: abhaydas
4 Replies
LEARN ABOUT MOJAVE
dirfd
DIRECTORY(3) BSD Library Functions Manual DIRECTORY(3)NAME
opendir, fdopendir, readdir, readdir_r, telldir, seekdir, rewinddir, closedir, dirfd -- directory operations
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <dirent.h>
DIR *
opendir(const char *filename);
DIR *
fdopendir(int fd);
struct dirent *
readdir(DIR *dirp);
int
readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
long
telldir(DIR *dirp);
void
seekdir(DIR *dirp, long loc);
void
rewinddir(DIR *dirp);
int
closedir(DIR *dirp);
int
dirfd(DIR *dirp);
DESCRIPTION
The opendir() function opens the directory named by filename, associates a directory stream with it and returns a pointer to be used to iden-
tify the directory stream in subsequent operations. The pointer NULL is returned if filename cannot be accessed, or if it cannot malloc(3)
enough memory to hold the whole thing, and sets the global variable errno to indicate the error.
The fdopendir() function is equivalent to the opendir() function except that the directory is specified by a file descriptor fd rather than
by a name.
Upon successful return from fdopendir(), the file descriptor is under the control of the system, and if any attempt is made to close the file
descriptor, or to modify the state of the associated description other than by means of closedir(), readdir(), readdir_r(), or rewinddir(),
the behavior is undefined. Upon calling closedir() the file descriptor is closed. The FD_CLOEXEC flag is set on the file descriptor by a
successful call to fdopendir().
The readdir() function returns a pointer to the next directory entry. It returns NULL upon reaching the end of the directory or on error.
In the event of an error, errno may be set to any of the values documented for the getdirentries(2) system call. Note that the order of the
directory entries vended by readdir() is not specified. Some filesystems may return entries in lexicographic sort order and others may not.
The readdir_r() function provides the same functionality as readdir(), but the caller must provide a directory entry buffer to store the
results in. If the read succeeds, result is pointed at the entry; upon reaching the end of the directory result is set to NULL. The
readdir_r() function returns 0 on success or an error number to indicate failure.
The telldir() function returns the current location associated with the named directory stream. Values returned by telldir() are good only
for the lifetime of the DIR pointer, dirp, from which they are derived. If the directory is closed and then reopened, prior values returned
by telldir() will no longer be valid.
The seekdir() function sets the position of the next readdir() operation on the directory stream. The new position reverts to the one asso-
ciated with the directory stream when the telldir() operation was performed.
The rewinddir() function resets the position of the named directory stream to the beginning of the directory.
The closedir() function closes the named directory stream and frees the structure associated with the dirp pointer, returning 0 on success.
On failure, -1 is returned and the global variable errno is set to indicate the error.
The dirfd() function returns the integer file descriptor associated with the named directory stream, see open(2). On failure, -1 is returned
and the global variable errno is set to indicate the error.
Sample code which searches a directory for entry ``name'' is:
dirp = opendir(".");
if (dirp == NULL)
return (ERROR);
len = strlen(name);
while ((dp = readdir(dirp)) != NULL) {
if (dp->d_namlen == len && strcmp(dp->d_name, name) == 0) {
(void)closedir(dirp);
return (FOUND);
}
}
(void)closedir(dirp);
return (NOT_FOUND);
SEE ALSO close(2), lseek(2), open(2), read(2), dir(5)HISTORY
The opendir(), readdir(), telldir(), seekdir(), rewinddir(), closedir(), and dirfd() functions appeared in 4.2BSD. The fdopendir() function
appeared in FreeBSD 8.0.
BSD April 16, 2008 BSD