Sponsored Content
Full Discussion: Creating a simple ID Script
Top Forums UNIX for Beginners Questions & Answers Creating a simple ID Script Post 302984259 by bakunin on Sunday 23rd of October 2016 03:35:35 PM
Old 10-23-2016
Quote:
Originally Posted by kkishore4580
Would I use the same functions in Linux/Ubuntu as I would in Python?
"Linux" (or "Unix", for that matter) is not a programming environment. Unixes (this includes Linux) use certain "shells" (commando processors, if you are proficient with Windoze: think of something similar in function to CMD.EXE, but with the capabilities of PowerShell included from the start).

Most of the shells (and all of the common ones) are not only built for interactive use but also have built-in languages which you can use to write programs ("scripts"). The syntax of these languages are quite similar, but not the same.

Today the overwhelming majority of scripting is done in one of two shells: bash (Bourne Again SHell) and ksh (Korn Shell). Both these languages are based on an older shell (the Bourne shell) and downwards compatible to it, so scripts written in strict Bourne shell code will run in both these shells and produce the same results. There is a newer standard to scripting, POSIX shell, which is based mostly on the Korn shell and both, bash and ksh are able to understand that standard. Both offer (different) features though, which are not part of this standard.

Linux distributions (not Ubuntu) usually come equipped with bash as the default shell, but can easily be changed to use the Korn shell, which is freely available today. Of the commercial Unixes some come with ksh (Solaris, AIX, if i remember correctly HP-Ux), some with Bourne shell (SCO, IRIX, and maybe - i can't remember - Tru64) but can utilize bash (which is also freely available) too.

Understand, that the shell language usually only covers the languages structure: you use system commands like you would use library functions in a high-level language. If you use everything your system offers it is likely that the next (different) system might not understand everything, like if you use the specialities of a certain compiler you may have to change your code if you switch to another compiler. This is why seasoned script programmers stay with the commands and options described in POSIX almost religiously, because this way they are guaranteed that their script runs on other platforms the same way it does so on theirs.

I hope this helps.

bakunin
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating a command history feature in a simple UNIX shell using C

I'm trying to write a history feature to a very simple UNIX shell that will list the last 10 commands used when control-c is pressed. A user can then run a previous command by typing r x, where x is the first letter of the command. I'm having quite a bit of trouble figuring out what I need to do, I... (2 Replies)
Discussion started by: -=Cn=-
2 Replies

2. Shell Programming and Scripting

creating a simple archiving script

Im trying to create a script to archive specified directories into a specified tarball backup file. This is what i want the input to look like ex. save -i '/bin/b*' -i '/bin/ls' -o backup this is what i have #!/bin/bash #save - backup file script unset myInput unset myOutput while... (3 Replies)
Discussion started by: lensmen
3 Replies

3. Shell Programming and Scripting

Creating simple shell program

Hi, I'm new to UNIX shell programming... can anyone help in doing the following : 1) create a text file named "Model File" having following columns : Name Number Physics Chemistry 2) prompt user to n rows enter the name, number, physics ,chemistry 3) display the entire columns and rows... (1 Reply)
Discussion started by: Mayuri P R
1 Replies

4. Programming

Creating a simple Help Desk system in PHP

hi guys i'm new to php,,i'm asked to develop a simple online help desk (where the admin can view the problem an forward it to another one to handle it and so on) or get a ready sytem then modify alil on it but i dont know where to start ir to find any suggestion please? (2 Replies)
Discussion started by: kedah160
2 Replies

5. UNIX for Dummies Questions & Answers

Help with creating a simple program!!

i am new to shell scripting!! i am making this program in bourne shell, that asks the user to input "Hello (their name)" or "question (their name)", any other input, "ERROR" will be outputted. if they input "Hello (name)", i want to out saying Hello (name) but if they input "question (name)", i... (4 Replies)
Discussion started by: bshell_1214
4 Replies

6. Shell Programming and Scripting

how to execute ksh simple shell script without creating .sh file

please help me to execute a simple shell script like for i in `ls echo $i done . i dont want to create a new sh file to execute it. Can i just type and execute it ? because I always this kind of simple for loops . Please help . Thanks (7 Replies)
Discussion started by: Sooraj_Linux
7 Replies

7. Homework & Coursework Questions

Help with creating a simple shell script

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: Write a shell script that accepts two arguments. The two arguments are the name of 2 files. • If the arguments... (3 Replies)
Discussion started by: Scripter12345
3 Replies

8. Web Development

Creating a Simple Linux Dashboard with Oracle Jet

Creating a Simple Linux Dashboard with Oracle Jet - Part 1 the Server Side PHP Code Creating a simple Linux dashboard with Oracle Jet is easy and fun. It's simple to create a dashboard to monitor your Linux server using Oracle JET. The sky is the limit with indicators and gauges. ... (7 Replies)
Discussion started by: Neo
7 Replies
CREATEDB(1)						  PostgreSQL Client Applications					       CREATEDB(1)

NAME
createdb - create a new PostgreSQL database SYNOPSIS
createdb [ options... ] [ dbname ] [ description ] DESCRIPTION
createdb creates a new PostgreSQL database. Normally, the database user who executes this command becomes the owner of the new database. However a different owner can be specified via the -O option, if the executing user has appropriate privileges. createdb is a shell script wrapper around the SQL command CREATE DATABASE [create_database(7)] via the PostgreSQL interactive terminal psql(1). Thus, there is nothing special about creating databases via this or other methods. This means that the psql program must be found by the script and that a database server must be running at the targeted port. Also, any default settings and environment variables avail- able to psql and the libpq front-end library will apply. OPTIONS
createdb accepts the following command-line arguments: dbname Specifies the name of the database to be created. The name must be unique among all PostgreSQL databases in this installation. The default is to create a database with the same name as the current system user. description This optionally specifies a comment to be associated with the newly created database. -D location --location location Specifies the alternative location for the database. See also initlocation(1). -e --echo Echo the queries that createdb generates and sends to the server. -E encoding --encoding encoding Specifies the character encoding scheme to be used in this database. -O owner --owner owner Specifies the database user who will own the new database. -q --quiet Do not display a response. -T template --template template Specifies the template database from which to build this database. The options -D, -E, -O, and -T correspond to options of the underlying SQL command CREATE DATABASE [create_database(7)]; see there for more information about them. createdb 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 host begins with a slash, it is used as the directory for the Unix domain socket. -p port --port port Specifies the Internet TCP/IP port or the local Unix domain socket file extension on which the server is listening for connections. -U username --username username User name to connect as -W --password Force password prompt. DIAGNOSTICS
CREATE DATABASE The database was successfully created. createdb: Database creation failed. (Says it all.) createdb: Comment creation failed. (Database was created.) The comment/description for the database could not be created. The database itself will have been created already. You can use the SQL command COMMENT ON DATABASE to create the comment later on. If there is an error condition, the backend error message will be displayed. See CREATE DATABASE [create_database(7)] and psql(1) for pos- sibilities. ENVIRONMENT
PGDATABASE If set, the name of the database to create, unless overridden on the command line. PGHOST PGPORT PGUSER Default connection parameters. PGUSER also determines the name of the database to create, if it is not specified on the command line or by PGDATABASE. EXAMPLES
To create the database demo using the default database server: $ createdb demo CREATE DATABASE The response is the same as you would have gotten from running the CREATE DATABASE SQL command. To create the database demo using the server on host eden, port 5000, using the LATIN1 encoding scheme with a look at the underlying query: $ createdb -p 5000 -h eden -E LATIN1 -e demo CREATE DATABASE "demo" WITH ENCODING = 'LATIN1' CREATE DATABASE SEE ALSO
dropdb(1), CREATE DATABASE [create_database(7)] Application 2002-11-22 CREATEDB(1)
All times are GMT -4. The time now is 04:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy