01-21-2020
Hi,
.. refers to the parent directory
. refers to the current directory
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have a script where I get the full directory path of the script being executed:
BASE=$0
echo "BASE:" $BASE
The output looks like this:
BASE: /webapps/appsdev/ACURA/rlz/oses3.sh
I'd like to truncate the shell name, leaving just the directory path. The directory path can be... (2 Replies)
Discussion started by: cwalsek
2 Replies
2. UNIX for Dummies Questions & Answers
Hi there,
I am putting a script together to apply a label to a directory structure but it can't be done down the directory structure, i must start at the end and work back and this is what i am struggling with.
for example, i will supply a path as an argument to a script, e.g
... (11 Replies)
Discussion started by: surfbus78
11 Replies
3. UNIX for Dummies Questions & Answers
If I the path to a directory, what command can I use to return the actual name of that directory.
test=`pwd`/folder1
> $test
folder1
I'd rather avoid anything with regular expressions. Any ideas? (1 Reply)
Discussion started by: ordano
1 Replies
4. HP-UX
Hi,
when ever i login my unix system it is going to root directory....how can i change it specified directory.. (3 Replies)
Discussion started by: rsivasan
3 Replies
5. Shell Programming and Scripting
Hi,
I have a file abcd.txt which has contents in the form of full path file names i.e.
$home> vi abcd.txt
/a/b/c/r1.txt
/q/w/e/r2.txt
/z/x/c/r3.txt
Now I want to retrieve only the directory path name for each row
i.e
/a/b/c/
/q/w/e/
How to get the same through shell script?... (7 Replies)
Discussion started by: royzlife
7 Replies
6. Shell Programming and Scripting
If I enter (simplified):
find . -printf "%p\n"
then all files in the output are prepended by a "." like
./local/share/test23.log
How can achieve that
a.) the leading "./" is omitted
and/or
b.) the full path to the current directory is inserted (enclosed by brackets and a blank)... (1 Reply)
Discussion started by: pstein
1 Replies
7. Shell Programming and Scripting
I have a below directory name
/root/logs/testing/today/
Here i have get to the value as '/root/logs/testing/' only without the last directory in a shell script. Do i need to use substr function here. Is there any other way around (6 Replies)
Discussion started by: vel4ever
6 Replies
8. Shell Programming and Scripting
Hello,
I am looking for a command that will give me the last directory name from a path
ex 1 :
/dir1/dir/2/dir3/
output needed
dir3
ex 2 :
/dir1/dir/2/dir3/dir4/
output needed
dir4 (1 Reply)
Discussion started by: Aswex
1 Replies
9. UNIX for Dummies Questions & Answers
My input is as below :
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/loyal/IFIND.HELLO.WROC.txt
/splunk/scrubbed/triumph/ifind.triumph.txt
From the above input I want to extract the file names only .
Basically I want to... (5 Replies)
Discussion started by: IshuGupta
5 Replies
10. UNIX for Beginners Questions & Answers
Hello,
I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies
rmdir(1) General Commands Manual rmdir(1)
NAME
rmdir - remove directories
SYNOPSIS
dir ...
DESCRIPTION
removes the directory entry for each dir operand that refers to an empty directory.
Directories are removed in the order specified. Consequently, if a directory and a subdirectory of that directory are both specified as
arguments, the subdirectory must be specified before the parent directory so that the parent directory will be empty when tries to remove
it. Removal of a directory requires write and search (execute) permission in its parent directory, but no permissions on the directory
itself; but if the sticky bit is set on the parent directory, only the owner of the directory, the owner of the parent directory, or a user
having appropriate privileges can remove the directory.
Options
recognizes the following options:
Force each directory to be removed without prompting for
confirmation, regardless of the presence of the option. This option also suppresses diagnostic messages regarding non-exis-
tent operands.
This option does not suppress any diagnostic messages other than those regarding non-existent operands. To suppress all
error message and interactive prompts, the option should be used while redirecting the standard error output to
This option ignores any previous occurrence of the option.
Write a prompt to the standard error output requesting confirmation
before removing each directory.
This option ignores any previous occurrence of the option.
Path removal.
If, after removing a directory with more than one pathname component, the parent directory of that directory is now empty,
removes the empty parent directory. This continues until encounters a non-empty parent directory, or until all components of
the original pathname have been removed.
When used in conjunction with the option, asks whether to remove each directory component of a path.
EXTERNAL INFLUENCES
Environment Variables
provides a default value for the internationalization variables that are unset or null. If is unset or null, the default value of "C" (see
lang(5)) is used. If any of the internationalization variables contains an invalid setting, will behave as if all internationalization
variables are set to "C". See environ(5).
If set to a non-empty string value, overrides the values of all the other internationalization variables.
determines the interpretation of dir names as single and/or multi-byte characters, the classification of characters as printable, and the
characters matched by character class expressions in regular expressions.
determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informa-
tive messages written to standard output.
determines the location of message catalogues for the processing of
International Code Set Support
Single- and multi-byte character code sets are supported.
DIAGNOSTICS
Generally self-explanatory. Note that the option does not suppress all diagnostic messages.
EXAMPLES
To remove directories with a prompt for verification:
directories
To remove as much as possible of a path, type:
SEE ALSO
rm(1), rmdir(2), stat(2).
STANDARDS CONFORMANCE
rmdir: SVID2, XPG2, XPG3, XPG4
rmdir(1)