Sponsored Content
Full Discussion: Re-writing ls -F command
Top Forums Programming Re-writing ls -F command Post 17705 by Perderabo on Tuesday 19th of March 2002 02:38:43 PM
Old 03-19-2002
It looks like you are trying to append an asterisk if both S_IXUSR and S_IFLNK are set. But earlier in your massive "if" statement you have already tested for S_IFLNK being set all by itself. So no condition can allow to reach the point where you append an asterisk.

Even if you square this away, you have a couple of other problems. S_IFLNK is a symlink, so instead of appending a blank (and what would be the point of that anyway), you want to append an at-sign.

Also, I think that for executables, you want to ensure first that S_IFREG is set and second that one or more of S_IXUSR, S_IXGRP, or S_IXOTH is set.
 

10 More Discussions You Might Find Interesting

1. Programming

writing your own command in unix/linux

Hi I am very new to Linux programming,otherwise I have exposure to Linux. Was thinking about something like writing my own commands for Linux. Any ideas where to start, any useful links and what I need to know before I start with this. Thanks :) Sidhu (3 Replies)
Discussion started by: Amardeep
3 Replies

2. Programming

Writing Makefile

Hello All; I am going to write an application in C/C++ which has so many source files and hence created many subdirectories. My area of concern is to write makefile. What i thought that each subdirectory would have own makefile and wanted to have one parent makefile which will call all ... (3 Replies)
Discussion started by: nikhildot
3 Replies

3. Shell Programming and Scripting

Accepting filename as command line param and writing to it

Hi, Is it possible to accept a filename as command line parameter and then write to that file using command redirection? i tried the below script. outputfile=`echo $1` echo "Writing to file" > 'echo $outputfile' exit $returncode but it isnt working. is there any other way to... (9 Replies)
Discussion started by: silas.john
9 Replies

4. Shell Programming and Scripting

Need help writing an Applescript to launch a specific Terminal Command...

I developed a script in Lingon (which is an automated script editor developed for OS X) that is used to automatically restart programs only if they crash. The script itself does just that, but I only want it to load if I'm going to use the specific application that it's designed to protect. In... (3 Replies)
Discussion started by: JFraser1
3 Replies

5. OS X (Apple)

Need help writing an Applescript to launch a specific Terminal Command...

I developed a script in Lingon (which is an automated script editor developed for OS X) that is used to automatically restart programs only if they crash. The script itself does just that, but I only want it to load if I'm going to use the specific application that it's designed to protect. In the... (2 Replies)
Discussion started by: JFraser1
2 Replies

6. Shell Programming and Scripting

Effect of using eval to execute a command as opposed to writing it on the commandline

cmd='date | wc' or cmd="date | wc" $cmdIf this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument". What is meant by expansion of pipe. When we execute date | wc on the command line, it... (2 Replies)
Discussion started by: daudiam
2 Replies

7. Red Hat

writing a script

Dear Madam/Sir Who can help me with writing a script doing the following? 1- Read names of files (only files with special name format let say initially they have the same file name start like TT*) 2- Then create an empty files with the same names have been read in step one but with extension... (1 Reply)
Discussion started by: m.nageeb
1 Replies

8. Shell Programming and Scripting

Writing file name and date from LS command into a file to be imported into mysql

I am looking to do a ls on a folder and have the output of the ls be structured so that is is modificaiton date, file name with the date in a format that is compatible with mysql. I am trying to build a table that stores the last modification date of certain files so I can display it on some web... (4 Replies)
Discussion started by: personalt
4 Replies

9. Shell Programming and Scripting

Preserving newlines when writing loops on the command line in bash

Dear All, I have a question that's been difficult to get an answer to. I often write command line loops, e.g. find files, print name, grep for term, apply sed, etc I use both zsh and bash. When I write a loop e.g. for line in `more myfile.txt` > do > echo $line > done but... (2 Replies)
Discussion started by: JohnK1
2 Replies

10. Shell Programming and Scripting

Run command without over-writing

I have a script called script.sh that has the following in it. cat /home/auto/script.sh #!/bin/bash ARGA=$1 if ; then echo "${ARGA}:Confirmed" else echo "${ARGA}:Unconfirmed" fi I need a way to run this script, and then, after script has confirmed the... (9 Replies)
Discussion started by: SkySmart
9 Replies
LFC_STATG(3)						       LFC Library Functions						      LFC_STATG(3)

NAME
lfc_statg - get information about a LFC file or directory in the name server SYNOPSIS
#include <sys/types.h> #include "lfc_api.h" int lfc_statg (const char *path, const char *guid, struct lfc_filestatg *statbuf) int lfc_statr (const char *sfn, struct lfc_filestatg *statbuf) DESCRIPTION
lfc_statg gets information about a LFC file or directory, having the given GUID, in the name server. lfc_statr retrieves information about the given replica. The file can be specified by path name or by guid. If both are given, they must point at the same file. guid specifies the Grid Unique IDentifier. path specifies the logical pathname relative to the current LFC directory or the full LFC pathname. sfn is either the Site URL or the Physical File Name for the replica. The structure pointed to by statbuf contains the following members: u_signed64 fileid; /* entry unique identifier */ char guid[CA_MAXGUIDLEN+1] /* GUID */ mode_t filemode; /* see below */ int nlink; /* number of files in a directory */ uid_t uid; gid_t gid; u_signed64 filesize; time_t atime; /* last access to file */ time_t mtime; /* last file modification */ time_t ctime; /* last metadata modification */ short fileclass; /* 1--> experiment, 2 --> user */ char status; /* '-' --> online, 'm' --> migrated */ char csumtype[3]; char csumvalue[33]; filemode is constructed by OR'ing the bits defined in <sys/stat.h> under Unix or "statbits.h" under Windows/NT: S_IFLNK 0xA000 symbolic link S_IFREG 0x8000 regular file S_IFDIR 0x4000 directory S_ISUID 0004000 set user ID on execution S_ISGID 0002000 set group ID on execution S_ISVTX 0001000 sticky bit S_IRUSR 0000400 read by owner S_IWUSR 0000200 write by owner S_IXUSR 0000100 execute/search by owner S_IRGRP 0000040 read by group S_IWGRP 0000020 write by group S_IXGRP 0000010 execute/search by group S_IROTH 0000004 read by others S_IWOTH 0000002 write by others S_IXOTH 0000001 execute/search by others RETURN VALUE
This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, serrno is set appropriately. ERRORS
ENOENT The named file/directory does not exist or is a null pathname. EACCES Search permission is denied on a component of the path prefix. EFAULT path or statbuf is a NULL pointer. EINVAL The length of the guid component exceeds CA_MAXGUIDLEN or path and guid are both given and they point at a different file. ENOTDIR A component of path prefix is not a directory. ENAMETOOLONG The length of path exceeds CA_MAXPATHLEN or the length of a path component exceeds CA_MAXNAMELEN or the length of the sfn exceeds CA_MAXSFNLEN. SENOSHOST Host unknown. SENOSSERV Service unknown. SECOMERR Communication error. ENSNACT Name server is not running or is being shutdown. SEE ALSO
Castor_limits(4), lfc_chdir(3), lfc_chmod(3), lfc_chown(3), lfc_creatg(3) AUTHOR
LCG Grid Deployment Team LFC
$Date: 2005/04/28 05:20:20 $ LFC_STATG(3)
All times are GMT -4. The time now is 09:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy