CTRL-C NOT WORKING

Remove this line in /etc/profile:

trap “” 1 2 3

Logout-Login


chmod: WARNING: can’t change /home

problem:
chmod 700 /home
chmod: WARNING: can't change /home

By default /home is used by automounter. 
/home is used to mount remote users' home. 

solution:
Create and use /export/home instead. 

* You can also remove /home in the /etc/auto_master file

HOW TO EMPTY MULTIPLE FILES USING WILDCARD (CLEAR CONTENTS)

Hi,

You can empty some files using the same wildcard:

### This command clears data in your files. Please be careful and take your own risk !

$ for i in your_wilcard*; do dd if=/dev/null of=$i; done

This command also does the same thing, but 1st one is my fav :)

$ find . -name "your_wildcard*" -exec basename {} \; | awk '{print "> "$1}' > a.sh
$ .  ./a.sh

try and pray :)


E212: Can’t open file for writing

Hi,

If you hit this error when saving in vi, probably the directory does not exist.
E212: Can’t open file for writing

vi /mydirectory/a.sql

:w
E212: Can’t open file for writing

quit vi

ls -ld /mydirectory
ls: mydirectory: No such file or directory

tray and pray :)


USING OR (-o) IN FIND COMMAND

 

Hi,

 

You can use or option (-o) in unix find commands:

find . -name “a*” -o “b*”

and this comment retrieves a* and b* wildcarded files/dirs in current directory.

Be careful when using one or more parameters more. (-mtime, ..)

find . -name “a*” -o “b*” -mtime +1

This does not retrieve 1 day old or newer a*, b* files, it retrieves a* files; or 1 day old b* files.

So it’s better to use 2 seperate commands:

find . -name “b*” -mtime +1

find . -name “a*” -mtime +1

 

try and pray :)


USING NOT EQUAL(!=) IN SHELL SCRIPTS

Hi,

Be careful when using not equal (!=) in if statements in shell scripts.

works:
if [[ "X"$VER1 != "X" && "X"$VER2 != "X" ]]
does not work properly (must be inserted white spaces before and after !=)
if [[ "X"$VER1!="X" && "X"$VER2!="X" ]]

try and pray :)


Follow

Get every new post delivered to your Inbox.