Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Print all the directory with no directory name mydir Post 302770121 by DGPickett on Thursday 14th of February 2013 01:27:20 PM
Old 02-14-2013
Well, sometimes it is cheaper to "2>/dev/null" than to test for potential directories or files.
  • You can test inside 'for x in zzz*;do ... done' to see if x is literally "zzz*" and continue. Note that the shell does all the work expanding glob expressions like zzz* without the cost of a fork()/exec() of 'ls' or 'find'.
  • The form 'ls zzz* 2>/dev/null | while read e' does nothing if zzz* does not expand, ls errors it out on stderr and it is never read from stdout pipe stdin into e, unlike the 'for' case.
  • The 'find' command does not complain or provide unexpanded glob expressions like 'zzz*', but it goes down the tree, whereas 'ls' just does the dirs or files (and unexpanded glob expressions like 'zzz*') it is given.

Last edited by DGPickett; 02-14-2013 at 02:38 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print all files of a directory

At the moment I do not know anything UNIX script :rolleyes: but i need to make script that prints the content of the archives (of text) that are deposited in a directory and Later erases these archives, leaving the directory emptiness It would be like repository for print please... (9 Replies)
Discussion started by: monica
9 Replies

2. Shell Programming and Scripting

How to print a directory list to a file?

I have directory of files listed with stats. I need to print only files with the same stats to a file. I tried this, and it printed a blank document. *1556 > tmp/list it did not work any suggestions? (3 Replies)
Discussion started by: rocinante
3 Replies

3. Solaris

delete buffer from print directory

Hi all, Operting system : Solaris 9 Oracle application: 11.5.10 i would like to ask query related to buffer area of pinter on solaris server. we are trying to print cheques using oracle application on network printer. some times it is printing the cheques with out any problem but... (1 Reply)
Discussion started by: maooah
1 Replies

4. Shell Programming and Scripting

Print directory name along with their path

Can any one tell me that how can i print all directory with their path in a given parent directory. i.e. parent directory /home/usr/ Now this shoe directory may contain sevral directory /home/usr dir1/ dir1.1/ dir1.2/ dir2 dir2.1/ dir2.2/ ... (5 Replies)
Discussion started by: jadoo_c2
5 Replies

5. Shell Programming and Scripting

[awk] print all filenames in directory

Hello, I was given a (I suppose) a simple task which I don't know how to do. Before coming here I have read a dozen of awk tutorials (full read, not just line-skipping) but I still don't know how to do this. Task: Write an script file 'check.awk' with a parameter current directory that... (5 Replies)
Discussion started by: c0dehunter
5 Replies

6. Shell Programming and Scripting

Print the current directory using perl

Hi I have this code to print the current directory using Perl use Cwd qw(abs_path); my $path = abs_path($0); print "$path\n"; But it is displaying my perl source code file along with the directory. like this C:\Perl\duration.pl But I want it only to display this... (1 Reply)
Discussion started by: srijith
1 Replies

7. Shell Programming and Scripting

Directory containing files,Print names of the files in the directory that are exactly same content.

Given a directory containing say a few thousand files, please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents. func(a_directory_name) output -> {“matches”: , ... ]} e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

8. UNIX for Advanced & Expert Users

A way to print only part of directory path

Hi, So I struggled to find a solution to the following problem: I want to make sed print only part of multiple different paths. So lets say we have /path/path1/path2/logs/bla/blabla /path/path1/path2/path3/logs/yadda/yadda/yadda Can someone suggest a way to make sed or other... (5 Replies)
Discussion started by: dampio
5 Replies

9. UNIX for Beginners Questions & Answers

Loop through directory and print on line

In the bash below I am trying to loop through all the R1.gz in a directory (always 1), store them in ARRAY, and cut them before the second _. That is being done but I can't seem to print then one a single line seperated by a space. Is the below the best way or is there a better solution? Thank you... (3 Replies)
Discussion started by: cmccabe
3 Replies
APM(8)							    BSD System Manager's Manual 						    APM(8)

NAME
apm, zzz -- Advanced Power Management control program SYNOPSIS
apm [-abdlmsSvz] [-f sockname] zzz [-Sz] [-f sockname] DESCRIPTION
The apm program communicates with the Advanced Power Management (APM) daemon, apmd(8), making requests of the current power status or placing the system either into suspend or stand-by state. The apm tool is only installed on supported platforms. With no flags, apm displays the current power management state in verbose form. Available command-line flags are: -z Put the system into suspend (deep sleep) mode. -S Put the system into stand-by (light sleep) mode. -l Display the estimated battery lifetime in percent. -m Display the estimated battery lifetime in minutes. -b Display the battery status: 0 means high, 1 means low, 2 means critical, 3 means charging, 4 means absent, and 255 means unknown. -a Display the external charger (A/C status): 0 means disconnected, 1 means connected, 2 means backup power source, and 255 means unknown. -s Display if power management is enabled. -v Request more verbose description of the displayed states. -f sockname Set the name of the socket via which to contact apmd(8) to sockname. -d Do not communicate with the APM daemon; attempt instead to manipulate the APM control device directly. The zzz variant of this command is an alternative for suspending the system. With no arguments, zzz places the system into suspend mode. The command line flags serve the same purpose as for the apm variant of this command. This command does not wait for positive confirmation that the requested mode has been entered; to do so would mean the command does not return until the system resumes from its sleep state. FILES
/var/run/apmdev is the default UNIX-domain socket used for communication with apmd(8). The -f flag may be used to specify an alternate socket name. The protection modes on this socket govern which users may access the APM functions. /dev/apmctl is the control device which is used when the -d flag is specified; it must be writable for the -d flag to work successfully. /dev/apm is the status device used when the socket is not accessible; it must be readable to provide current APM status. SEE ALSO
acpi(4), apm(4), apmd(8) Intel Corporation and Microsoft Corporation, Advanced Power Management (APM) BIOS Interface Specification, Revision 1.2, February 1996. HISTORY
The apm command appeared in NetBSD 1.3. The APM specification first appeared in 1992. The last update to the standard was made in 1996 - the same year when it was superceded by the ACPI 1.0 standard. Thereafter power management on IBM-compatible personal computers has relied on ACPI, implemented in NetBSD by the acpi(4) subsystem. The acpi(4) provides an emulation layer for the legacy apm. BSD
March 20, 2010 BSD
All times are GMT -4. The time now is 02:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy