How to print the first array element?



How to print the first array element?..

Answer / Sandeep Gupta

To print the first element of an array in a shell script, you can use the following command:n```bashnarray=("one" "two" "three")necho ${array[0]}n``

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Shell Script Interview Questions

What does echo mean in scripting?

1 Answers  


Explain about return code?

1 Answers  


A file has multiple records each having three 30-bit long fields(field1,field2,field3).There is also a lookup file,LOOK_UP.dat.Now, we need to consider only the last ten digits of field1 and lookup the file LOOK_UP.dat. If there a match then field2 and field3 should replaced with corresponding data from the lookup file. otherwise that particular record,for which there is no match, should be stored in a seperate file.

2 Answers   Wipro,


What will happen to my current process when I execute a command using exec?

1 Answers  


Explain about sourcing commands?

1 Answers  


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

1 Answers  


What is the lifespan of a variable inside a shell script?

1 Answers  


I want to read all input to the command from file1 direct all output to file2 and error to file 3, how can I achieve this?

1 Answers  


I Forgot My Windows Vista Password! How Can I Find My Windows Lost Password?

1 Answers  


What is the best shell scripting language?

1 Answers  


how to find weblogic version through linux cammand

1 Answers   L&T,


What are filters explain sort with all the options available?

1 Answers  


Categories