Wednesday, December 26, 2012

Get the input from command line(STDIN) & Write into File & Display in STDOUT put


#!/bin/bash
echo -e "Enter the Rollno";
read rollNo;
echo -e "Enter the Name";
read name;
echo -e "Enter the Marks";
read marks;
echo "$rollNo|$name|$marks" > studentDb

echo -e " StudentDb is created....."
echo -e " StudentDb records :"
cat studentDb


OUTPUT :

-bash-3.2$ sh HelloWorld
Enter the Rollno
07mx10
Enter the Name
Chidambaram
Enter the Marks
100
 StudentDb is created.....
 StudentDb records :
07mx10|Chidambaram|100

Here
#!/bin/bash            --> the program will run in bash shell
read <variable>     --->  is used to get the input from keyboard, no need to define any data types.
>                           -->   is used to redirect the output into studentDb file
cat studentDb         -->  the file content is displayed in command line

No comments:

Post a Comment

Oracle EBS R12 – Query to View Consolidated Invoice Details with Individual Transactions

SELECT     hp.party_name                  AS customer_name,     aca.account_number             AS customer_account,     hci.cons_billing_num...