Originally posted by pavan bellari:
There are 3 questions. pls reply this
-----------------------------------------------------
how to execute wall command in shell script
desc:
how to pass messages to users logged in thru wall command from shell script
As the man page says,
wall "message"
Is there a problem?
-----------------------------------------------------
how to change directory(cd command) from shell script
for eg:
in shell script i have given cd/home
but when i execute shell scipt the directory remains the same with out change.
The "cd" command only affects the shell it's executed in; if you run a script in a subshell, cd commands in the script won't affect the original shell. You can "source" a shell script instead of executing it; this will read the file and execute the commands in the current shell. So instead of
machine% foo
you'd type
machine% source foo
how to flash a message when user logs in
desc:
to give a message from root to a particular user so that when ever the user logs in, the first message must be "Contact System Administrator" and system should not allow the user to do any thing further. only message should be flashed
-----------------------------------------------------
thanks in advance
I'm not familiar with a specific tool that would help you in this antisocial practice, but if you replace the user's default shell with a program that displays that message, then you'd get the desired effect -- i.e., edit /etc/passwd and replace /bin/bash with /sbin/rudemessage for that user. You'd have to put /sbin/rudemessage in /etc/shells.
(Note that /sbin/rudemessage is a program you'd have to write yourself.)