soft or symbolic is more of a short cut to the original file....if you delete the original the shortcut fails and if you only delete the short cut nothing happens to the original.
hard link is more of a mirror copy....do something to file1 and it appears in file 2
deleting one still keeps the other ok
Showing posts with label Bash. Show all posts
Showing posts with label Bash. Show all posts
Monday, 5 July 2010
Saturday, 3 July 2010
Little bash scripting learning
Variables:
- $? -- the exit status of last command
- 0 = success
- fail otherwise
- $# -- No. of arguments
- $@ -- All the arguments
Thursday, 1 July 2010
List file full path in Bash
$PWD contains the full path of the current directory.
To output the full path of a file, you can simply do
echo "$PWD/filename"
Easy and useful!
To output the full path of a file, you can simply do
echo "$PWD/filename"
Easy and useful!
Labels:
Bash
Wednesday, 30 June 2010
Find by file name in Bash
Easy but useful command:
To find a file by name, use 'find' command. It will search all assigned path including its sub-folders
To find a file by name, use 'find' command. It will search all assigned path including its sub-folders
- find
- 1st argument: the path to find
- -name: file by name
- -i: case insensitive
Monday, 28 June 2010
Bash scripting
Start doing a bit bash scripting now....
this is some thing that fairly simple but took me a few minutes to figure out how...
this is some thing that fairly simple but took me a few minutes to figure out how...
- You can't use alias by default unless you turn on some kind of options
- to run a variable as a command, there are three commands that you can use
- eval, exec, source
- Variable should be upper case!
Saturday, 26 June 2010
Some simple bash hints
- Command
- ls - list files
- --color=auto: Display files with different colors base on their types
- -C: Display files by column
- set - showing all environment variables
- du - show file size
- -s: summary
- -h: human readable
- cd
- -: go to the previous directory
- history - show command history
- use '!' rerun the command. e.g. !4
- '!!' will run last command
- '!-2' will run the second last command
- use 'export HISTCONTROL=ignoredups' to get rid of duplications
- basename - show the name of a file. (remove directory path)
- can also be used to remove suffixes by add a 2nd argument with the suffixes
- dirname - show the directory of a file
Setting Up Emacs for Windows
Here is a good .el to help emacs recognize cygwin path style
http://www.emacswiki.org/cgi-bin/wiki/download/cygwin-mount.el
to enable
(require 'cygwin-mount)
http://www.emacswiki.org/cgi-bin/wiki/download/cygwin-mount.el
to enable
(require 'cygwin-mount)
(cygwin-mount-activate)
There is a problem with the PS1 variable of bash. Emacs doesn't recognize the escape characters for colours. The solution is to add a condition to the bash profile:
if [ $TERM = emacs] ; then
PS1='\u@\h:\W\n$'
fi
Friday, 25 June 2010
Using quotes in Bash
This is probably incomplete, the quote in bash has the following usage:
A good Bash scripting tutorial, I need to come back and read it!
- Single Quotes (') - preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.
- e.g. echo '\"This Text is writing between two single quotes! $User' will return the original sentence: \"This Text is writing between two single quotes! $User
- Double Quotes (") - preserves the literal value of all characters within the quotes, with the exception of `$', ``', and `\'.
- e.g. echo '\"This Text is writing between two single quotes! $User' will return the sentence: "This Text is writing between two single quotes! Yi
A good Bash scripting tutorial, I need to come back and read it!
Labels:
Bash
Subscribe to:
Posts (Atom)