Let's assume that my welcome.sh is like below which later included using . within main.sh file.
$ cat >welcome.sh
echo "Welcome to shell script programing"
$ cat >main.sh
. welcome.sh
echo "This is main file"
$ sh main.sh
Welcome to shell script programing
This is main file
- Dot (.) is the part of the hidden file name. A leading dot is the prefix of a "hidden" file.
$ ls
main.sh newfile semicolon_test.sh welcome.sh
$ touch .hidden_file
$ ls
main.sh newfile semicolon_test.sh welcome.sh
$ ls -a
. .. .hidden_file main.sh newfile semicolon_test.sh welcome.sh
In the example ls -a shows the hidden file .hidden_file
- When working with directory, a single dot (.) represents the current working directory, and two dots (..) represent the parent directory.
Example:
$ pwd
/home/Arju/t_dir
$ cd .
$ pwd
/home/Arju/t_dir
$ cd ..
$ pwd
/home/Arju
- While copying files we can use dot (.) to represent current directory.
The following example will copy the file /home/Arju/f to present working directory.
$ cp /home/Arju/f .
- In case of regular expression while matching characters, a "dot" matches a single character. About dot (.) it is discussed in http://arjudba.blogspot.com/2009/07/list-of-metacharacters-in-regular.html
Related Documents
No comments:
Post a Comment