gudii9
asked on
touch cat vi differences
What are differences between
touch cat vi differences
which one is better to use to create a file. When to use which one. please advise
touch cat vi differences
which one is better to use to create a file. When to use which one. please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please re-read my answer!
cat and touch c a n do the same (if you "cat" an empty file into a new one an empty file is created), but cat isn't really meant for this (see above).
touch, on the other hand, never writes content to a file, it changes its date (and creates it, if not present).
cat and touch c a n do the same (if you "cat" an empty file into a new one an empty file is created), but cat isn't really meant for this (see above).
touch, on the other hand, never writes content to a file, it changes its date (and creates it, if not present).
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> Also always use full path.
Here goes exceptions because of not using full path.
Initially doing unalias for ls command and redirecting the error (if any) to /dev/null
Here goes exceptions because of not using full path.
Initially doing unalias for ls command and redirecting the error (if any) to /dev/null
$ unalias ls 2>/dev/null
Writing a sample function for ls:$ unset -f ls
$ ls ()
{
echo "Use full path instead of using ls command"
echo "/bin/ls $@"
Ret=13
return $Ret
}
$ ls /home/MurugesanDinesh
Use full path instead of using ls command
/bin/ls /home/MurugesanDinesh
$ echo "Return value of previous ls command is [ $? ] which needs to be 13 since we have written 13 in ls function"
Return value of previous ls command is [ 13 ] which needs to be 13 since we have written 13 in ls function
$ echo "Return value of previous echo command is [ $? ] which needs to be 0 since we have used expected output of echo command"
Return value of previous echo command is [ 0 ] which needs to be 0 since we have used expected output of echo command
ASKER
cat and touch does same things?