Shell Script for Unix Date ???
I need one shell script to change unix machine date ..
That script will take date as command line argument Login and password should be hard coded in the script Pls Help |
And this is homework for which University?
|
I am sorry if this is an easy questions...Will be thankful if you help me..Let yu tell myattempt:
echo –n “login” sty -echo echo -n "Password: " stty -echo read passwords #tty echo #echo "" # force a carriage return to be output correct="$(cat /etc/verify)" if [$password = $correct] ; then echo “Enter the Year” read y echo “Enter the month” read m echo “Enter the Day” read d echo “The Date modified is $m-$d-$y” else failed=$((failed + 1)) Does the Concept sounds Good? |
Please use the code -tags.
|
I dint get it....Hows it work?
|
You don't need to do a "force carriage return", by the way. \n works well I find. Also, you're not actually changing the date. You're just outputting that you are.
What Zmyrgel meant is to enclose your code in [ code ][ /code ] tags, without the spaces between the brackets and the letters. For example, here is your code in code tags: Code:
echo –n “login” |
Okies...I got a point that code should be enclose within the code.
But why yu people are really not ready to help me out with this? Pls Help me with this shell script? I tried but couldnt help myself? |
We aren't very willing because it sounds an awful lot like homework. Additionally, the first page under a Google of "change linux date" reveals the answer...which might be another reason someone's not too willing. A 'man date' command would probably give you the answer, in fact! It's rather obvious that you've tried to rely on your existing knowledge to fix the problem, then asked for help without looking first.
Sorry to sound harsh, but the rules say no homework help. And generally you should try to find the answer on your own before asking. Additional places you could've looked: LinuxQuestions Wiki Forum search After learning and understanding the information, it should be trivial to use variables to set the date. Google - It's Your Friend |
Lemme take it as a challenge..Good Inspirational Task
|
are you a programmer, are you asking help because you need help with shell script?
i can see helping with the homeworks is against the rules, otherwise it would break the whole education system..but maybe i can give you start.. first of all look for a bash scripting tutorial and write a small hello world example. if you are a programmer you would understand the syntax quickly. Then get a little bit deeper and learn how to manipulate variables, functions, I/O. After getting an abstract idea of the scripting language google for the functions you need. how to change the date, how to read user name etc.. final part is obvious..just combine them..write your code..if you then have problem, and you post your code, i think(not 100% sure:) ) you will get help as it is no more your homework but a spesific question. |
Quote:
|
you are right, i don't how but i've missed that..
|
All times are GMT -5. The time now is 12:28 AM. |