answersLogoWhite

0

📱

Unix

Unix is a family of operating systems primarily designed for servers, mainframes, and high-end workstations. First created in 1969, Unix systems are renowned for their security and stability.

1,127 Questions

Program in shell of implementing cp command?

The 'cp' command is a primitive command; there isn't anything really in the shell to accomplish this. You could use other commands for 'cp' (such as 'cat') but those are also primitive commands.

How do you write a shell script for student database?

perfect code:

create ()

{

echo "Enter the filename which you want to create"

read db

touch $db

echo "File created"

}

insert()

{

if [ -z $db ];then

echo "Database doesnt exist. Create a new database."

else

echo "Enter the number of records to be added."

read no

while [ $no -gt 0 ]

do

echo "Enter roll no: "

read rno

srno=`grep "^$rno" "$db"`

if [ -z $srno ]

then

echo "Enter Name: "

read name

echo "Subject 1: "

read sub1

echo "Subject 2: "

read sub2

echo "Subject 3: "

read sub3

avg=$((($sub1+$sub2+$sub3)/3))

echo "Average : $avg"

record=$rno":"$name":"$sub1":"$sub2":"$sub3":"$avg

echo $record >> "$db"

no=$(($no-1))

else

echo "Record already exists."

fi

done

fi

}

search()

{

echo " Enter roll no: "

read rno

record=`grep "^$rno" "$db"`

if [ $? -ne 0 ]; then

echo "Record doesnt exist. "

else

echo "Record found"

echo $record

fi

}

modify()

{

echo " Enter roll no to modify: "

read rno

grep "^$rno" $db > temp1.txt

grep -v "^$rno" $db > temp2.txt

mv temp2.txt $db

if [ $? -ne 0 ]; then

echo "Record doesnt exist. "

else

name=`cut -d ";" -f2 "temp1.txt"`

sub1=`cut -d ";" -f3 "temp1.txt"`

sub2=`cut -d ";" -f4 "temp1.txt"`

sub3=`cut -d ";" -f5 "temp1.txt"`

echo "Enter the value you want to modify"

MENU=" Values

1)Name

2)Subject 1 marks

3)Subject 2 marks

4)Subject 3 marks

"

echo "$MENU"

echo "Enter your choice"

read n1

case $n1 in

1)

echo "Enter the new name"

read name

;;

2)

echo "Enter the new marks for subject 1"

read sub1

;;

3)

echo "Enter the new marks for subject 2"

read sub2

;;

4)

echo "Enter the new marks for subject 3"

read sub3

;;

*)

echo "Enter a vaid choice"

;;

esac

avg=$((($sub1+$sub2+$sub3)/3))

record=$rno";"$name";"$sub1";"$sub2";"$sub3";"$avg

echo $record >> "$db"

fi

}

delete()

{

echo " Enter roll no: "

read rno

record=`grep "^$rno" "$db"`

if [ $? -ne 0 ]; then

echo "Record doesnt exist. "

else

echo "Record found"

echo $record

record=`grep -v "^$rno" "$db" > tmp.txt`

mv tmp.txt $db

echo "Record deleted."

fi

}

display()

{

echo " Complete database..."

cat $db

}

MENU1="***********Menu***********

1)Create

2)Insert

3)Search

4)Modify

5)Delete

6)Display

7)Exit

"

while true

do

echo $MENU1

echo "Enter the choice: "

read n

case $n in

1) create

;;

2)insert

;;

3) search

;;

4) modify

;;

5) delete

;;

6) display

;;

7) exit

;;

esac

done

#written by:Fabianski Benjamin

You need to type in a line of text to the end of a file called Annual Report What command in unix enables you to add the text?

Assuming that the report is also a plain text file, use the following:

echo This is the last line of text >> AnnualReport

What are the differences between Unix and Mac OS X?

Unix is a specification. Mac OS X is a certified implementation of Unix. This like asking "What is the difference between a turtle and a red-eared slider."

Where do i download true color 32 bit resolution for windows 98?

Color resolution isn't something that is "downloaded." It is something that is provided by a driver. Make sure that you have installed the driver for your video card.

How is pine different from mailx?

Pine is a third-party software package that does not come with Unix or Linux; it has to be installed. It was written for a beginner in mind so that they didn't have to know a lot about the Unix environment when using mail.

Mailx is a standard Unix mail client that is typically supplied with a Unix install. It is somewhat easy to use but requires the user to know how to use an editor such as 'vi' and to use somewhat arcane means of answering mail.

What does X OPEN represent?

X Open represents a European consortium designed to develop standards for the Information Technology area. See the related link for detailed information.

What is use of -exec in find command of unix?

The -exec option executes the following command on a target of the 'find' command.

Can PureDarwin run Mac OS X applications?

Generally speaking, no. Binaries compiled on PureDarwin can be run on Mac OS X, but most applications (with the exception of some command-line tools) use libraries like Carbon or Cocoa that aren't available on PureDarwin.

How do you save a file to the root?

You can only save a file to the root directory of a system (in Unix) if you have permission to do so, and most users do not have this permission. Also, it is unnecessary (and a bad idea) to save files to the root directory; usually only other directories are placed here.

Having said that, it depends on the program you are running, in terms of saving to the root directory.

Which command in unix is used to run the script immediately?

As long as the script file is readable and executable, just type the name of the script and it will execute immediately.

Otherwise, you can call the shell interpreter and have it run it immediately such as:

bash ./thefile

where ./thefile is the script you want to run. Or, substitute the shell interpreter you wish to use instead of bash, such as sh, ksh, tcsh, csh, etc.

Free unix operating system source code?

If I understand your question....vague as it is....yes, the Unix OS source code is free and open source.

Does IBM aix support x86 system?

IBM AIX currently only supports Power chip processors, which are not the Intel X86 format.

What is a Unix console?

A Unix console is a CLI interface through which to control or monitor a Unix computer.

What is SIGBUS?

SIGBUS is an event that occurs when a program or application tries to do something with memory it doesn't own or memory that is readonly. It is a "bus error", related to bad memory handling.

See the related link for detailed information.

How do you open a read only file in Unix?

You can open any read-only file in Unix assuming that you have the read permission. Any utility or program that can get access to that file in read mode can open it, which would include programs such as 'more', 'less', 'vi', 'cat', etc.

Read-only merely means you can't change it; but you could copy it or look at it.

How can you protect zip file with password with the help of UNIX script?

A Unix script is not necessary. The zip utility has the capability of compressing the files with a password.

How do you switch users in Unix?

A user may switch their identities when logged in using the 'su' command. On some systems the 'su' command may be restricted.

In Unix and Linux which one is CUI?

Neither one is strictly CUI (Character User Interface). Both can use a variety of user interfaces, notably that of an X server.

What is the Command to display the default shell in unix?

There isn't a concept of a 'default' shell in Unix; you may have a login shell specified by the system administrator for use when you log in. Although it isn't a fool-proof way to find your shell, you could use the command:

echo $SHELL

or use the 'finger' command to see what your default login shell environment is. You could also 'grep' for your information in the password file because the last field is your login environment shell.