Sponsored Content
Full Discussion: two script problems
Top Forums Shell Programming and Scripting two script problems Post 302348637 by cfajohnson on Friday 28th of August 2009 09:40:27 PM
Old 08-28-2009
Quote:
Originally Posted by zappedback
i have two problems with my phone book script the first i want to only allow a valid name if it has letters and spaces not a number in the name. so "joe smith" is ok "joe smith1" is not ok.

Code:
name="Joe Smith"
case $name in
     *[!a-zA-Z ]*) echo invalid name ;;
     *) echo OK ;;
esac

Quote:
the second problem is how can i cut a name out of a txt file i have this as my test txt file
joe blogs 12345678
smith peter 43667843
joe smith 54329875
david cooper 78564429
peter cooper 89975563

now how do i search the txt file and only remove the one line say joe smith and not the other smith.

Code:
name='joe smith'
grep -v "$name" FILENAME

Quote:
im entering the info into the script with positional paramiters so to run my script i use ./book.sh "joe smith"
hope someone can help me here im loving learning linux scripting Smilie thankyou for any help you can give me.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

having ksh script problems

well i have written a script to telnet and ftp to all my servers, the script runs great, BUT i can not for the life of me figure out how to get the script to repeat if the conditions are not filled. this is what i have so far ######################################### TorF(){ echo T... (4 Replies)
Discussion started by: jerzey4life
4 Replies

2. UNIX for Dummies Questions & Answers

Copy Script Problems .....

I got this script: print -n "Enter file name: " read name .... ..... ..... etc but at the prmpt, when I press enter (without typin a word), comes up with sum error message, is there away of getting it not to print that message?? (8 Replies)
Discussion started by: Makaveli.2003
8 Replies

3. UNIX for Dummies Questions & Answers

script problems

Hi, Here is an example of a problem I have: File2: contain the following lines: a^ aaa^aa aa^~ b^ bbb^bb bb^~ c^ ccc^cc cc^~ d^ dddd^dd dd^~ File1: contain the following lines: b^ bbb^bb bb^~ c^ ccc^cc cc^~ I get File2 as input and I want to do as following: for each line in... (3 Replies)
Discussion started by: hellsd
3 Replies

4. Shell Programming and Scripting

Problems with an if/then loop within a script

Hi there, I have written a script to clear out log files from the var/tmp dir. It works up to a point. What I needed to do was to exit the script if there was no files to be deleted. I can get this working on a test script but when I implement it into my program it errors out with a `then` not... (3 Replies)
Discussion started by: lodey
3 Replies

5. Shell Programming and Scripting

Shell script problems to do

Does anyone know a good site to do shell script problems? (0 Replies)
Discussion started by: cleansing_flame
0 Replies

6. Shell Programming and Scripting

Script problems

Hi Can anybody please explain how the below script works and if there is any problems with it? The script is part of an archival process but it keeps crashing out. #!/sbin/sh - clear purgelist="/var/opt/moto/live/scripts/old_messages_purge_list" for i in `cat $purgelist` do ... (2 Replies)
Discussion started by: runnerpaul
2 Replies

7. UNIX for Dummies Questions & Answers

Problems with script and Cron

Hi Guys, total newbie here, Ive read through some of the threads about cron and scripts not working and have still drawn a blank as to why mine isnt working correctly. I have a script that runs the ausearch with a set of criteria i have setup, the only access i have to the system is via... (5 Replies)
Discussion started by: richie190784
5 Replies

8. Shell Programming and Scripting

shell script to call perl script problems

Ok, don't ask me why, but all calls to perl must be called by a shell script. Its really not ideal, but its what I have to work with. Calling it isnt the issue, its passing in the arguments. I have about 1000 perl scripts to call by a shell script. Right now, I'm executing the shell script... (3 Replies)
Discussion started by: regexnub
3 Replies

9. Homework & Coursework Questions

Problems executing script

Hi, I'm a complete novice to Linux and UNIX. I'm having trouble getting a script to execute properly. I did a similar script earlier in the semester with no problems. For whatever reason I can't get this one to work. Any help would be greatly appreciated as I'm completely lost and frustrated at... (5 Replies)
Discussion started by: Lindy70
5 Replies

10. Shell Programming and Scripting

Shell Script Problems

Hi, I'm newbie in the shell script world and i want to solve some problems I am experiencing. My main goal is to create a ksh script to use 2 text files as input to execute a local shell script(create user commands in the criar.users.aix file) through a ssh connection in which the list of... (1 Reply)
Discussion started by: joaochambino
1 Replies
DROPUSER(1)						  PostgreSQL Client Applications					       DROPUSER(1)

NAME
dropuser - remove a PostgreSQL user account SYNOPSIS
dropuser [ option... ] [ username ] DESCRIPTION
dropuser removes an existing PostgreSQL user. Only superusers and users with the CREATEROLE privilege can remove PostgreSQL users. (To remove a superuser, you must yourself be a superuser.) dropuser is a wrapper around the SQL command DROP ROLE [drop_role(7)]. There is no effective difference between dropping users via this utility and via other methods for accessing the server. OPTIONS
dropuser accepts the following command-line arguments: username Specifies the name of the PostgreSQL user to be removed. You will be prompted for a name if none is specified on the command line. -e --echo Echo the commands that dropuser generates and sends to the server. -i --interactive Prompt for confirmation before actually removing the user. dropuser also accepts the following command-line arguments for connection parameters: -h host --host host Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. -p port --port port Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. -U username --username username User name to connect as (not the user name to drop). -w --no-password Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. -W --password Force dropuser to prompt for a password before connecting to a database. This option is never essential, since dropuser will automatically prompt for a password if the server demands password authentica- tion. However, dropuser will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. ENVIRONMENT
PGHOST PGPORT PGUSER Default connection parameters This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see in the documentation). DIAGNOSTICS
In case of difficulty, see DROP ROLE [drop_role(7)] and psql(1) for discussions of potential problems and error messages. The database server must be running at the targeted host. Also, any default connection settings and environment variables used by the libpq front-end library will apply. EXAMPLES
To remove user joe from the default database server: $ dropuser joe To remove user joe using the server on host eden, port 5000, with verification and a peek at the underlying command: $ dropuser -p 5000 -h eden -i -e joe Role "joe" will be permanently removed. Are you sure? (y/n) y DROP ROLE joe; SEE ALSO
createuser(1), DROP ROLE [drop_role(7)] Application 2010-05-14 DROPUSER(1)
All times are GMT -4. The time now is 11:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy