Shell Script

Ques:- what is the difference between sh & bash shell?
Recent Answer : Added by Admin On 2020-05-17 11:38:50:

SH refers to Bourne Shell, which is someway the reference Shell to a lot of other Shells, and defintaly to the Bash Shell, which literally is : Bourne Again Shell. By this time and date (2015), Bash is to be preferred over Bourne, and Bourne is supposed to be limited too much … but, still used a lot. Obviously, in a technical way, there’s a lot of interesting commands that work only with Bash, not with Bourne (and presumingly, never the other way round). So, bottom line : Bourne is limited but very compatible, Bash is better but slightly limited. The latter largely depends on environments.

Ques:- Please give me example of ” at command , contrab command ” how to use
Ques:- how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?
Ques:- RAM one table colums a1,a2,a3,a4 respective values 2,4,7,8 KRISH one table colums a1,a2,a3,a4 respective values 3,4,6,9 IN RAM & KRISH a4 column if comparing values RAM A4 – KRISH A4 ( 8-9 =1 THEN print 5 or (RAM) a4 value 10 KRISH a4 values 2 then 10 -2 =8 print 5*8=40 or diff 5 print same
Recent Answer : Added by Admin On 2020-05-17 11:38:50:

x=`cut -f4 ram.txt`
y=`cut -f5 krish.txt`
z=`expr x-y`
if (z==5)
then echo 5
else
w= `expr 5*z`
echo $w
fi

Ques:- i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff
Ques:- Hi, I want to practise Unix korn shell scripting which i learnt 2 yr bfr. plz suggest software i can use to practise.
Recent Answer : Added by Admin On 2020-05-17 11:38:50:

you can use CYGWIN which can be installed on various Windows platform.

Ques:- how to separate the even and odd number generated from one file to two separate file i.e. even numbers in file1.txt and odd numbers in file2.txt
Recent Answer : Added by Admin On 2020-05-17 11:38:50:

echo enter filename
read file
for n in `cat $file`
do
i=`expr $n % 2`
if [ $i -eq 0 ]
then
echo $n>>even.txt
else
echo $n>>odd.txt
fi
done

Ques:- how to find weblogic version through linux cammand
Recent Answer : Added by Admin On 2020-05-17 11:38:49:

$ java weblogic.version -verbose
(OR)
$ java weblogic.utils.Versions
(OR)
java weblogic.Admin -url ManagedHost:8001 -username weblogic
-password weblogic VERSION

Ques:- what is info area how many types?
Ques:- write a scwipt that a) takes exactly one argument, a directory name. b) if the number of argument is more or less than one,print a usage message c) if the argument is not adirectory, print another message d) for the given directory, print the five biggest files and the five files that were most recently modified. e) save the output to a file called q2output.
Recent Answer : Added by Admin On 2020-05-17 11:38:49:

for var in `ls -1S` === -S sort the file primary key as
size of the file and -1 column o/p
do
if [[ $i -eq 5 ]]
then
break;
fi
print $var
let i=i+1;
done
Same code can be used for time and ls command option will be
ls -1t

Ques:- What is the difference between running a script as ./scriptname.sh and sh scriptname.sh
Recent Answer : Added by Admin On 2020-05-17 11:38:48:

while running the script using this “./” script run from
curent location we have to give executable permision to the
script file
By default file contains 644 permissions there is no
execute permission while running it shows error
use `chmod` to give execute permission and run
where as “sh” it runs the script with the help of default
shell

Ques:- Set up a Sev 2 alert when the Primary WA service fails. A windows batch script needs to be created that will monitor the WA service on the Primary and when the service stops/fails a Sev 2 TT is generated for a particular team ?
Ques:- what is tickets $ what low,medium,high priorite pls define time also
Ques:- Hi All, Is it possible to create one file name only space or space in file name in UNIX and we can able to run that on Unix?
Recent Answer : Added by Admin On 2020-05-17 11:38:45:

Yes..:)
just open unix prompt
vi ” ” or vi “ab cd”
echo “jagadeeb”
:wq
just give permission :)like
chmod 777 ” ” or chmod 777 “ab cd”
and run that like
./” ” or ./”ab cd”
out put like
jagadeeb
jagadeeb@gmail.com

Ques:- if i have 2 files file1 and file2…. file1 contains 2 columns like b a 11 aa 12 as 13 ad 15 ag 11 ar 13 ah 15 ak file2 contains b c 10 ds 11 at 15 gh 15 jk 13 iu 11 fg 13 yy can any 1 give me the program to display in this way? a b c aa 11 at ar 11 fg ad 13 iu ah 13 yy ag 15 gh ak 15 jk
Recent Answer : Added by Admin On 2020-05-17 11:38:46:

Sorry Sudhir,
Your syntax is wrong.It should be
paste file1 file2|cut -d ” ” -f2,3,4
But this command is n’t providing the correct result.
Piz try another.

Ques:- In a file , how to retrieve the lines which are the multiples of 50 ? like 50,100,150th lines etc.
Recent Answer : Added by Admin On 2020-05-17 11:38:46:

awk ‘NR % 50 == 0’ print

Ques:- Create a bash shell script that reads a line from the user consisting of 5 words and then prints them out in reverse order. Name this script “reverse.sh”
Recent Answer : Added by Admin On 2020-05-17 11:38:44:

read line;
echo $line | awk ‘{ for ( i = NF; i > 0; i–) print $i}’ |
tr “n” ” “

Ques:- Create a bash shell script that reads in a number from the user. If the number is 1, print out the date. If the number is 2, list the files in the current directory. If the number is 3, print out who is currently logged onto the system. If the number is anything else, print out an error message and exit. Name this script “various.sh”
Recent Answer : Added by Admin On 2020-05-17 11:38:45:

cho “Enter Choice”
read num
case $num in
1) echo `date`
;;
2) ls
;;
3) who
;;
*) echo “Wrong option press 1 2 3 only”
;;
esac

Ques:- Hi, all Scripting professional. Q. I have written script1.sh and calling script2.sh in script1.sh file using bash shell as interpreter and my log in shell also bash shell.My code like Script1 #!/bin/bash echo “My script2 call” . script2.sh Here script2.sh file run successfully but when I have changed my interpreter bash to ksh like #!/bin/ksh Error are comming script2.sh command not found. Guid me how to call other script in our main script.
Recent Answer : Added by Admin On 2020-05-17 11:38:45:

write code like this :
#!/bin/bash
echo “My script2 call”
/bin/bash ./script2.sh [ or /bin/ksh ./script2.sh ]
It will run ….. enjoy !!!!!!

Ques:- What are the 4 basics of OOP?
Recent Answer : Added by Admin On 2020-05-17 11:38:44:

1.Data Abstraction
2.Data Encapsulation
3.Polymorphism
4.Inheritance

Ques:- How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output of ls -l command.
Recent Answer : Added by Admin On 2020-05-17 11:38:44:

$ ls -al | sort -n -k5
The -n in my example means “sort numerically”, and the -k5
option means to key off of column five. Like other Unix
commands, these options can be combined and shortened, like
this:
$ ls -al | sort -nk5

Ques:- madhar chod unix ke 10 commands dhang se likh nahi sakta hai
Ques:- 1.Write a script, which converts a number from binary to hexadecimal format or vice versa.
Recent Answer : Added by Admin On 2020-05-17 11:38:44:

echo ‘obase=16 ; ibase =2 ; binaryno’|bc #print hexadecimal
echo ‘obase=2 ; ibase=16; hexa no’|bc #print binary no

Ques:- is this growing field and what is average package in this?
Ques:- In a single command how do you run the previous command in the command prompt.
Recent Answer : Added by Admin On 2020-05-17 11:38:48:

type “r”. It will execute the last executed command

Ques:- Please anyone suggest atleast 2 good training institutes in Hyderabad, INDIA where i can learn unix shell scripting.
Recent Answer : Added by Admin On 2020-05-17 11:38:47:

follow sunitabh Das unix book

Ques:- Where cron file kept?
Recent Answer : Added by Admin On 2020-05-17 11:38:47:

It is in /var/spool/cron/crontabs
Each user have seperate file in this location. moreover
normal user cannot view this file, only root user can
access.

Ques:- How to know that your remote server is ruing smoothly or not in unix?
Recent Answer : Added by Admin On 2020-05-17 11:38:42:

login to the remote server using ssh and use top -d1 command
, it will show the load average on the server.

Ques:- Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.
Ques:- Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.
Scroll to top