I have two instances of it being used and I am wondering what each does:
service=~mv ~/Desktop/Service$version.tgz $service
What does the little squiggly ~ do?
Then, after that that, what would cd $service do?
|
I have two instances of it being used and I am wondering what each does:
What does the little squiggly Then, after that that, what would
| |||||||||||||||||
feedback
|
This question came from our site for professional and enthusiast programmers.
|
The squiggly thing is called a "tilde". It expands to your home directory. Try
Both statements put your home directory by itself on a line.. See bash Tilde Expansion for details. | |||||
feedback
|
|
The "squiggly" is called a tilde. It is used to refer to your home directory which on Linux, is normally You can also use this to refer to another user's home directory. For instance, if the other user's username is The first example you've given sets the variable The second example copies the file
or
or
The third will change the current working directory (
or
| |||||||||||||
feedback
|
|
In both #1 & #2: ~ is your home directory, so if you are qwerty it will likely be the directory /home/qwerty. So try For #1: it looks to me like the variable service is being defined as your home directory. That means after #2 has moved the tgz file from the Desktop subdirectory to your home directory, #3 then changes to the home directory. | |||
|
feedback
|
|
It looks like the commands are doing the following.
So, all the script is doing is just cleaning up your desktop by moving the file to your | ||||
|
feedback
|
|
I'll add here that ~user also expands to [user]'s home directory, so it's not just a shortcut for your own home directory. E.g.:
| |||
|
feedback
|