Question: I open firefox and browse through sites. Sometimes, automatically, the cursor stops moving, I can't use the keyboard too and system is hung. It doesn't go to the command line either. I found out that this may mostly be due to a adobe flash plugin. I don't know which one or which one to remove. 

Every time this happens I have to manually force shutdown the computer and switch it on again.

I know I've been pretty vague in giving details but I don't know how exactly this problem occurs.

I'm using Ubuntu 14.04.

Answer: 
> 
> 2. `#!/bin/bash` & zsh emulate: The first line declare that this script is running in bash. So, why there is a emulate, which is from zsh?
> 
> 
> 

The first line, the shebang, only indicates that if the script is executed directly, it would be run using bash. Nothing prevents you from running it using zsh:

```
zsh admin.sh

```

I don't know why the author thought to test for zsh, but they did. This section of code is for zsh, and won't run in bash:

```
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage.  Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST

```

> 
> 3. `alias -g '${1+"$@"}'='"$@"'`: I just input this on another bash and get the error: `-g :invalid option`, I'm confused about the difference of zsh & bash, and how they work together. Could you explain it to me, please?
> 
> 
> 

That's a very broad question. I won't explain all the differences of zsh and bash - go read the documentation of both for that. For the specific point of `alias -g`, zsh has *global* aliases. In bash, aliases are only substituted at the start of the line. In zsh, `alias -g` defines global aliases which are substituted everywhere in the line.

So, in zsh, if I do:

```
alias -g foo=bar

```

And then run:

```
echo foo

```

The output will be:

```
bar

```
Your questions lacks info, but I'll try to answer it like this:

1. sed regexp demystify

```
s/\([`"$\\]\)/\\\1/g'
^     ^         ^----------------- with The character with a leading \
      | 
|     | --- the characters `"$\
|
|-- replace

```

So `"` becomes `\"`
2. I have no idea, zsh isn't my cup of tea when you are running scripts.
3. Test if statements like this:

```
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 
     echo "Does the if statement run in my shell?"; 
else 
     echo "The else statement runs in my shell"; 
fi 

```