EzDev.org

scripts interview questions

Top 15 scripts interview questions

10156 Jobs openings for scripts


How to make Skype use notify-osd?

How do I make Skype use the default Ubuntu notify-osd to display notifications (incoming messages, users connecting, etc.) instead of the Skype's own "ugly" message box?


Source: (StackOverflow)

Why does Python in Linux require the line #!/usr/bin/python?

Pretty simple question: In Linux, why does Python require the line

#!/usr/bin/python

at the start of a python file, since Windows doesn't?

What does it do? 'cause the description "Links to Python" is a bit vague...


Source: (StackOverflow)

How to execute a script just by double clicking like .EXE files in Windows?

How can I make a bash script executable by double clicking just like .exe files in Windows? I tried creating a launcher and assigning the script to it, but there are two consequences:

  1. the terminal twinkles, disappears, and nothing is done.
  2. you must specify to run in terminal in order to work.

I have a script that installs tomcat on an offline PC, including all dependencies of tomcat in the script. I need to make the script work on double clicking like windows since most who use the script will not be familiar with Ubuntu.

Forget the above explanation. I want to make a script that can be run by double-clicking on it, without using the terminal. Anybody knows how?


Source: (StackOverflow)

How to run a script during boot as root

I had a script that automatically enables my wifi without using networkmanager, but I don't know how to run the script as root while the system is booting. How do I make the script run automatically during boot?


Source: (StackOverflow)

How can I make cowsay say something every time I close the terminal?

I want cowsay to print something like "have a nice day" when I close the terminal. I know I have to have some kind of script, but I'm not even sure how to write a script or how to use it once it's written. Any advice?


Source: (StackOverflow)

How can a script check if it's being run as root?

I'm writing a simple bash script, but I need it to check whether it's being run as root or not. I know there's probably a very simple way to do that, but I have no idea how.

Just to be clear:
What's a simple way to write a script foo.sh, so that the command ./foo.sh outputs 0, and the command sudo ./foo.sh outputs 1?


Source: (StackOverflow)

How do I create a deb package for a single python script?

I have a single python script that I want to distribute as a deb package. It is a indicator which shows local date in Unity panel. I did follow create a .deb Package from scripts or binaries but I could not create a deb package because it fails.

Can someone give me a step-by-step instruction on what I should do? As far as I know this script depends on python-appindicator.

NOTE:
I do not want any links to Debian/Ubuntu packaging instructions. I have seen most of them. I don't find them beginner friendly.


Source: (StackOverflow)

How can I make a script that opens terminal windows and executes commands in them?

I have three scripts I need to run when I start up my Ubuntu machine, they start services I use in my development environment.

To do that, I manually open three terminals and type in the commands.

Is there any way to create a script that will open three terminals and execute one command in each of these? (Each command should be in a separate terminal window so I can see their output).


Source: (StackOverflow)

How can I create a select menu in a shell script?

I'm creating a simple bash script and I want to create a select menu in it, like this:

./script

echo "Choose your option:"

1) Option 1  
2) Option 2  
3) Option 3  
4) Quit  

And according to user's choice, I want different actions to be executed. I'm a bash shell scripting noob, I've searched the web for some answers, but got nothing really concrete.


Source: (StackOverflow)

Can I make the webcam take a picture when an incorrect password is entered?

I am using a laptop . I was thinking to have a support in my Ubuntu machine. When an incorrect password is entered, a picture is taken later revealing who has been trying to gain access.

I have searched around and the only thing I have found is stuff to do this on Macs. Is It possible to write a script for Ubuntu to do same .

If possible then what is a script or Software to make this happen.


Source: (StackOverflow)

Command to append line to a text file without opening an editor

Assuming i have a line that i want to add to a file without opening an editor.

How could i append this line

alias list='ls -cl --group-directories-first'

to this file

config.fish

Source: (StackOverflow)

How to add a shell script to launcher as shortcut [duplicate]

Possible Duplicate:
How can I edit/create new launcher items in Unity by hand?
How can I create launchers on my desktop?

I want to add some shell scripts in my launcher as shortcuts..

They are located deep inside and i have to navigate to it every time to execute them...

I tried this link where the 2nd answers seems to solvee it but as said in comments neither can i find any option to add a launcher..

I guess it existed in 11.04 with a "+" button on launcher but i use 12.04.

So how do i get this working?? And i need those commands everytime for sure..!


Source: (StackOverflow)

How to read complete line in 'for' loop with spaces

I am trying to run a for loop for file and I want to display whole line. But instead its displaying last word only. I want the complete line.

for j in `cat ./file_wget_med`

do
echo $j

done

result after run:

Found.

Here is my data:

$ cat file_wget_med
2013-09-11 14:27:03 ERROR 404: Not Found.

Source: (StackOverflow)

Bash remove first and last characters from a string

I have a string like that:

|abcdefg|

And i want to get a new string called in someway (like string2) with the original string without the two | at the start and at the end of it

so that i will have this

abcdefg

is that possible in bash?


Source: (StackOverflow)

How can I get a list of all repositories and PPAs from the command line into an install script?

I know how to list all packages installed on my system.

But how could I get a list of all repositories and PPA's?

I know I can look into /etc/apt/sources.list and /etc/apt/sources.list.d, but I'm looking for a way to generate a script that executes all apt-add-repository commands on a new system (that sorts out getting all keys).

Any ideas?


Source: (StackOverflow)