Sponsored Content
Top Forums Shell Programming and Scripting Need help with Bash scripting using nano editor Post 302560754 by SANA4SPA on Friday 30th of September 2011 10:04:42 PM
Old 09-30-2011
Need help with Bash scripting using nano editor

p { margin-bottom: 0.08in; } As you can already tell I am a newbie. I took a Microsoft VB2008 a few month back. Now I'm taking Linux + and this course requires me to write scripts. The script executes but, I can't figure out or have not found anything that I can make out on the internet that can answer my questions.


1 I need to make this two statements: if [ "$user_ID" = jcs ] && [ "$password" = 123456 ]
2 If they enter anything other than y they should get message Goodbye
3 Any comments would be appreciated.
4 I would like to add a counter

Code:
 #!/bin/bash
 # Date: 09/25/2011
 # Purpose: Authenticate  
 # Creator: JCS
 # Lasted Changed: 09/25/2011
 clear
 echo -n -e "\n\n\nPlease enter you ID:     "
 read user_ID
 clear
 echo -n -e "\n\n\nPlease enter your password     "
 read password
 clear
 *****if [ "$user_ID" = jcs ] && [ "$password" = 123456 ]; then     
 echo -e "\n\n\nYou have been authenticated."
 else
 echo -n -e "\n\n\nThere is a problem with your authentication. Would you like to try again, enter y for yes."
 read answer
 fi
 while [ "$answer" = y ];
 do
 echo -e "\n\n\nPlease enter you ID:     "
 read user_ID
 clear
 echo -e "Please enter your password     "
 read password
 clear
 if [ "$user_ID" = jcs ] && [ "$password" = 123456 ]; then
    echo -e "You have been authenticated."
 else
 ***echo -e "There is a problem with your authentication. Would you like to try again. Enter y for yes"
 read entry
 fi
 done


Moderator's Comments:
Mod Comment Video tutorial on how to use code tags in The UNIX and Linux Forums.

Last edited by Franklin52; 10-01-2011 at 05:55 AM.. Reason: Please use code tags for data and code samples, thank you
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Scripting

Hello there peeps: There is a little piece of bash shell scripting problem i have, which i was hoping you could help me with. #!/bin/bash stored_word() { case $(( $$ % 8 )) in 0 ) echo "energy";; 1 ) echo "touch";; 2 ) echo "climbing";; 3 ) echo... (3 Replies)
Discussion started by: keyvan
3 Replies

2. Shell Programming and Scripting

please help with Bash Scripting????

Hi, can anyone help me with my scrip please. I wanted do following tasks: 1. List all the directory 2. A STDIN to ask user to enter a directory name from listed directories 3. command to check if the directory exists( or a command to validate if the user entered a valid directory name) ... (2 Replies)
Discussion started by: eminjan
2 Replies

3. Shell Programming and Scripting

bash scripting help

have this code but when i run it i get this error ./pulse: line 2: and here is the code #!/bin/bash if ; then pulseaudio -k; fi what am i doing wrong thanks Adam (5 Replies)
Discussion started by: ab52
5 Replies

4. Shell Programming and Scripting

Bash scripting

Try to imagine a flag: nnnnx nnnxx nnxxx nxxxx now imagine how it will output: 4 times the "n"and 1 times "x" 3 times "n"and" 2 times" x " .. etc. .. rhombus is the same only instead of "n" is there gap "and " x "is a few times to form the correct shape Can you help... (3 Replies)
Discussion started by: krcek12
3 Replies

5. Shell Programming and Scripting

[Solved] Help with running ps -e | less on nano script editor

p { margin-bottom: 0.08in; } This is just a portion of a script I'm writing on Linux nano script editor. When I run the script I get stuck on the ps -e | less command portion of the script:wall:. It displays all the process running but it does not allow me to move to the next line on the script.... (2 Replies)
Discussion started by: SANA4SPA
2 Replies

6. Shell Programming and Scripting

bash scripting help

Hi Guys i have a <script?> that spits out the location of each printer using snpget here is the code for i in `sed -n '/Start Printer/,/End Printer/p' /hosts/blah/etc/dhcp/hosts.conf | awk '!/^#/ {print $2}' | egrep -v \... (2 Replies)
Discussion started by: ab52
2 Replies

7. Shell Programming and Scripting

bash scripting

same script: 1- i am using grep to find a string called: tinker panic 0 in a file /etc/ntp.conf if the string is not there, i want to add the strings in /etc/ntp.conf file in the first line of the file. if not do nothing or exit. 2- also i want to add # in front of the following lines in... (0 Replies)
Discussion started by: lamoul
0 Replies

8. Homework & Coursework Questions

Bash Scripting

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Try running 'phone4 xyz' and see what happens. Modify your program so that if no matching name is found, an... (1 Reply)
Discussion started by: OmgHaxor
1 Replies

9. UNIX for Beginners Questions & Answers

Vim, vi and nano editor shows help.txt automatically

Hi, Whenever i try to open a file in any editor like vi, vim and nano i get this help.txt showing up in split screen without any key being pressed. This continues to pop up even when i close the help.txt. This behavior happens only when i am connected via putty. Is there a fix to this issue? ... (1 Reply)
Discussion started by: sunil0391
1 Replies
KAS_CREATE(8)						       AFS Command Reference						     KAS_CREATE(8)

NAME
kas_create - Creates an entry in the Authentication Database SYNOPSIS
kas create -name <name of user> [-initial_password <initial password>] [-admin_username <admin principal to use for authentication>] [-password_for_admin <admin password>] [-cell <cell name>] [-servers <explicit list of authentication servers>+] [-noauth] [-help] kas c -na <name of user> [-i <initial password>] [-a <admin principal to use for authentication>] [-p <admin password>] [-c <cell name>] [-s <explicit list of authentication servers>+] [-no] [-h] DESCRIPTION
The kas create command creates an entry in the Authentication Database for the user named by the -name argument. To avoid having the account's initial password echo visibly at the shell prompt, omit the -initial_password argument; the command interpreter prompts for the password and does not echo it visibly. Whether or not -initial_password is omitted, the Authentication Server converts the password into a form suitable for use as an encryption key, and records it in the entry's key field. To alter settings in an Authentication Database entry, use the kas setfields command. To examine an entry, use the kas examine command. To list every entry in the database, use the kas list command. OPTIONS
-name <name of user> Names the new Authentication Database entry. Because it is the name under which the user logs in, it must obey the restrictions that many operating systems impose on user names (usually, to contain no more than eight lowercase letters). -initial_password <initial password> Sets the user's password; provide a character string that can include uppercase and lowercase letters, numerals and punctuation. The Authentication Server scrambles the string into an octal string suitable for use as an encryption key before placing it in the entry's key field. If this argument is omitted, the command interpreter prompts for the string and does not echo it visibly. -admin_username <admin principal> Specifies the user identity under which to authenticate with the Authentication Server for execution of the command. For more details, see kas(8). -password_for_admin <admin password> Specifies the password of the command's issuer. If it is omitted (as recommended), the kas command interpreter prompts for it and does not echo it visibly. For more details, see kas(8). -cell <cell name> Names the cell in which to run the command. For more details, see kas(8). -servers <authentication servers> Names each machine running an Authentication Server with which to establish a connection. For more details, see kas(8). -noauth Assigns the unprivileged identity "anonymous" to the issuer. For more details, see kas(8). -help Prints the online help for this command. All other valid options are ignored. EXAMPLES
The following example shows the prompts that appear when an administrator logged in as "admin" creates an Authentication Database entry for the user "smith", and does not include either the -initial_password or -password_for_admin arguments. % kas create smith Password for admin: initial_password: Verifying, please re-enter initial_password: PRIVILEGE REQUIRED
The issuer must have the "ADMIN" flag set on his or her Authentication Database entry. SEE ALSO
kas(8), kas_examine(8), kas_list(8), kas_setfields(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 KAS_CREATE(8)
All times are GMT -4. The time now is 05:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy