creating a schema


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers creating a schema
# 1  
Old 12-01-2008
creating a schema

hi guys,
Unix dummy here.
I need help creating a script for class.
The assignment reads as follows:
create a script that will create a new schema in schema.txt, it must accept 7 arguments (the first being the name of the schema) the other 6 being the 6 field names. the schema has to be tested to make sure it isn't in the file schema.txt and if all passes then the arguments should be appended to the file schema.txt

this is what I have so far:

#!/bin/sh
if [ ! $# -ge 2 ] && [ ! $# -le 7 ]
then
echo "Usage: ns.sh <schema_name> <field_names>"
elif [ ! -f schemas.txt ]
echo "schemas.txt": file could not be found.
elif [ ! -r schemas.txt ]
echo "schemas.txt": unable to read file.
elif [ ! -w schemas.txt ]
echo "schemas.txt": unable to write upon file.
elif [ "`grep"^$1\" schema.txt`" ]
echo schema already defined as $1
else
$@ >> schema.txt
fi


when I run it, this happens:

sena@linprog1.cs.fsu.edu:~/a5>ns.sh cars make model year
ns.sh: line 7: syntax error near unexpected token `elif'
ns.sh: line 7: `elif [ ! -r schemas.txt ]'


As far as appending the arguments to schema I don't know what to do
Any help would be awesome!
# 2  
Old 12-01-2008
We do not allow classwork posting here.

However without giving a direct answer you should be able to get an answer by perusing the correct syntax for the if/elif/else control statement in the man page for your shell.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can I import a particular schema from full dump in Oracle?

Hi All, I have a full oracle dump file that I have exported from a production server. I want to import a specific schema out of the full dump. Is that possible in oracle. What will be the command for that? (6 Replies)
Discussion started by: Palak Sharma
6 Replies

2. Shell Programming and Scripting

Parallel export of all oracle DB schema.

In my Oracle db there are 4 schemas. All the username & passwords are stored in a text file. I am using a while loop to export all the schemas. It read the first line and doing the export. For all users it export one by one. But I need all the schemas will exported simultaneously. i.e. all the... (1 Reply)
Discussion started by: priya001
1 Replies

3. Cybersecurity

LDAP rfc2307bis.schema or nis.schema?

Hi guys, we are implementing new ldap in our organization exclusively for Linux authentication purposes. As we are new to the subject, I would appreciate help regarding which schema to use to create group of users and accounts / passwords entries? I see both schemas listed in subject above... (0 Replies)
Discussion started by: Lastminute
0 Replies

4. Emergency UNIX and Linux Support

Toad for Oracle 11G Schema browser

Need a help ..Schema browser in Toad not listing the tables when i connected to Oracle 11g schema did any body faced the issue... ? How to resolve the issue.. I need it asap thats y posted here Thanks (5 Replies)
Discussion started by: girija
5 Replies

5. UNIX and Linux Applications

Toad for Oracle 11G - schema browser not working

Need a help Schema browser in Toad not listing the tables when i connected to Oracle 11g schema did any body faced the issue... ? How to resolve the issue (0 Replies)
Discussion started by: girija
0 Replies

6. Shell Programming and Scripting

find a column in a schema

Hi, I need my script to accept a column name and give all the tables and its schema. Any kind of help is appreciated... Thanks in advance... (2 Replies)
Discussion started by: bankimmehta
2 Replies

7. Shell Programming and Scripting

Script for checking schema satistics in Oracle

I have a script which gives the output of schemas in Oracle DB : #!/bin/ksh ps -ef | grep -v grep | grep ora_pmon_$1 | wc -l | while read CONTROL do if ; then ORACLE_HOME=/u01/app/oracle/product/9.2.0 export ORACLE_HOME PATH=$ORACLE_HOME/bin:$PATH:/bin:/usr/bin:usr/local/bin:. ... (0 Replies)
Discussion started by: run_time_error
0 Replies
Login or Register to Ask a Question