and placed it in /usr/bin directory. It runs fine if I use ./script-name.sh but I want it to execute by just typing script-name in all accounts. How do I do that? And How to put colors to the ouput text? And How can I put this script in MOTD so that whenever a user loggs in He gets this Info without having to type the command?

where every second 0 is a code you would find in the page linked above.

Note: you should use vim, and <ctrl-v><ctrl-[>[ to get correct escape sequence: ^[[

Thanks for your reply. But I tried it and nothing is happening. I know I'm not following you completely. But as you said I created a file "bootmisc.sh" in /var/init.d/, since there was no one before and added these lines:

I tried putting these lines in motd; If I put with echo -e " I only see echo -e" , when I login , and If I put the script directly in the /etc/motd file (^[[00; ..) . I see a blank page and the curser is moved to the middle of the page. Can you tell me exactly how to use this command in motd in CentOS?

and placed it in /usr/bin directory. It runs fine if I use ./script-name.sh but I want it to execute by just typing script-name in all accounts. How do I do that? And How to put colors to the ouput text? And How can I put this script in MOTD so that whenever a user loggs in He gets this Info without having to type the command?

I think the color issue is handled pretty well with the link given above......first of all, if you want the script named "script-name" and NOT "script-name.sh" ...... change the name....... "mv script-name.sh script-name"Make sure it's executable ........ "chmod 755 script-name"

Assuming you put this script in /usr/bin ...... you should be able to launch it now by simply typing "script-name".

Alternatively you could also create an alias in your .bashrc file to do the same thing.The alias would look something like

alias script-name='/usr/bin/script-name.sh'

You would then have to re-source your .bashrc file to make it active with the command source ~/.bashrc

Well, unfortunately, I think what you're asking for can't be done (at least easily, or you could take a look at `man -k getty` pages), or not the way you want as /etc/motd is an ascii text file where no variable will be expanded.You won't either be able to print user's and machine's usage data, at user's login, in it as it's only root writable.

Therefor, you could add a line at the end of the users and /etc/skeleton/{,.bashrc}, that calls a script that gathers all data you want to prompt

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum