Saturday, October 3, 2009

Shame on Bangladesh! Girl Raped by a BAL leader video hits the market

In Bangladesh, a leader of the current government party Awami League's (BAL) unit Bangladesh Chhatra League (BCL), in Pirojpur district has lured a class X student to a love trap, raped her and recorded it in cellphone.

The video footage has reached local youths through cellphone, flash drives and CDs and is also on sale in video stores.

Ahsan Kabir Mamun alias Mamun Hawlader, information and research secretary of district unit BCL, student front of ruling Awami League, admitted the rape but pinned the blame on political and business rivals for the video.

The culprit Mamun said in an emotionless voice the rape was "recorded secretly" to tarnish his political and business image.

This is the second such incident after a gang in Faridpur in July raped a schoolgirl, recorded the scene and released the footage. Faridpur police could not arrest the culprits two months into that incident.

Mamun said he was "in a relation" with the class X student of Karimunnessa Girls' High School for the last one year.

He added he met the girl on her way to school a week before the Ramadan and lured her to the house of a lawyer, an acquaintance, on Shikarpur Road to "discuss something important".

At one stage of their conversation Mamun raped the girl. He claims Monir Hossain alias 'Ganja' Monir, local locksmith Altaf Sheikh's son and a BNP activist, "secretly" recorded the rape in his cellphone.

He claims he 'deleted' the footage recorded by Monir but at the same time pins the blame on Monir for its release with the help of a cellphone repairer on Pourashava Road.

He also points finger at Alamkathi ward Jubo League leader Ramiz Sarder and district BCL joint general secretaries Sajib Khan Rana and Badsha Howlader for "spreading" the footage to sideline him in business.

"The girl is my close relative and my family would soon arrange our wedding after consultation with her family," he claims.

Asked about the matter, 'Ganja' Monir said though he is member of a rival political group, he has been a very close friend of Mamun since childhood.

Monir admits the rape and recording it but says he had done it as "instructed" by Mamun. He says he has no idea how the footage hit the market.

Many ones correspondent acted as a buyer of pornography Saturday morning and bought a CD from a video shop in the town.

Speaking anonymously, the video shop owner said the CD was available in the market soon after the Eid but he does not know who are behind it.

The family of the victim demanded exemplary punishment of everyone involved.

They said they would go for legal action, adding Mamun, an addict, is their close relative who used to tease the girl on her way to school.

Asked over phone, Officer-in-Charge of Sadar police Mir Fashiar Rahman expressed his ignorance but said he would look into the matter.

Superintendent of Police Md Shahidullah Chowdhury said that they would seize the video footage from the market and take necessary action against the persons responsible.

But it is very unfortunate that this tiger Mamun in Pirojpur still visible in front of people. Due to ruling party leader police do not arrest him. The same was true with Awami League leader Manik who celebrated his 100 times rape celebration with his caders.

What I can say here? Just shame on Bangladesh!








Exclamation mark in shell script and linux

The exclamation mark (!) in shell script just reverse the effect of test and exit status.
Example of ! about how it inverts the exit status of a command

$ cat >exit_status_check.sh
ls nofile_exist.txt
echo $?
! ls nofile_exist.txt
echo $?

$ sh exit_status_check.sh
ls: cannot access nofile_exist.txt: No such file or directory
2
ls: cannot access nofile_exist.txt: No such file or directory
0

In the example exclamation mark just reverse the exit status of ls command.

- With test operator "!" inverts the meaning of the test.

- ! is a bash keyword. With #, ! is used to determine the interpreter of shell command which is discussed on http://arjudba.blogspot.com/2009/04/what-is-sharp-bang-appear-at-first.html.

- ! also can be used as indirect variable assignment.
Example:

$ cat >indirect_ref.txt
v=variable
variable=2
echo "v = $v" # Direct reference.

echo "Now v = ${!v}" # Indirect reference.
# The ${!variable} notation is more intuitive than the old
#+ eval var1=\$$var2

$ sh indirect_ref.txt
v = variable
Now v = 2


- From the command line, the ! invokes the Bash history mechanism. Note that within a script, the history mechanism is disabled.

Related Documents

Colon (:) character in shell script and Linux

- The colon character (:) in shell script is considered as NULL command. It means do no operation (Do nothing). The ":" command is itself a Bash builtin, and its exit status is true (0).
Demonstration here,

$ :

$ echo $?
0

- The colon is used in case of while loop to make endless iteration. Example of while endless loop is,

while :
do
...
done

which is same as,

while true
do
...
done

- Colon (:) can be used as placeholder in if/then test.
Example:

if condition
then : # Do nothing and branch ahead
else # Or else ...
take-some-action
fi

After "then" the colon (:) indicates do nothing if "if condition" is satisfied and ahead branch.

- In case of, "${parameter:-default}" colon (:) makes a difference only when the parameter has been declared, but is set to null. In this case it will echo default. Example.

$ cat >colon_test.sh
# Colon makes to trigger the default optuion
#+if the variable is declared and set to null/

username=
echo "username has been declared, but is set to null."
echo "username = ${username-`whoami`}"
# This will not echo as variable is set to null and is not used colon (:).


echo "username = ${username:-`whoami`}"
# Will echo the execution of `whoami` command as we used colon (:) here.

$ sh colon_test.sh
username has been declared, but is set to null.
username =
username = Arju

$ whoami
Arju


- In case of arithmetic operations, while assigning variable ":" is necessary because otherwise Bash attempts to interpret statement as a command.
Example:

$ cat >arithmetic_colon.sh

n=1; echo -n "$n "
: $((n = $n + 1))
# Here ":" is necessary. If we don't use colon then Bash attempts
#+ to interpret "$((n = $n + 1))" as a command.
echo -n "$n "

$ sh arithmetic_colon.sh
1 2

Note that we could also increment n by 1 using "(( n = n + 1 ))" or "n=$(($n + 1))".

- Colon (:) also can be used to evaluate environmental variable. Before doing any operation it can be checked whether certain environmental variable is set.

$ cat >check_environment.sh
# Check some of the system's environmental variables.
: ${HOSTNAME?} ${USER?}

$ sh check_environment.sh

$ cat >check_environment2.sh
# Check some of the system's environmental variables.
: ${HOSTNAME?} ${USER?} ${ORACLE_HOME?}

$ sh check_environment2.sh
check_environment2.sh: line 2: ${$ORACLRACLE_HOME?}: bad substitution

In the above example see if all environmental variables were set then no error returned but as ORACLE_HOME variable was not set and so it returned error.

- In combination with the redirection operator (>) colon, truncates a file to zero length, without changing its permissions. If the file did not previously exist, creates it.
For example

$ : >new_file.txt # File "new_file.txt" is now empty.

It have the similar effect as statement cat /dev/null >new_file.txt however, this does not fork a new process, since ":" is a builtin.

If : is used with >> redirection operator, then it has no effect on a pre-existing target file (: >> target_file). If the file did not previously exist, then it creates it.

- Colon (:) can be used to comment a line but not recommended. Because with : error checking is done in the line.

- The ":" also serves as a field separator, in /etc/passwd, and in the $PATH variable.
Example:

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin


Related Documents

Forward slash and backslash in shell script and linux

Forward Slash in Linux and shell script
- The forward slash(/) is filename path separator in linux as well as in shell script. For example if we issue pwd then you will see the current directory location and location components might be separated by forward slash.

$ pwd
/home/Arju/t_dir

- Forward slash (/) is also arithmetic operator and works do division.
Example:

$ expr 18 / 4
4

Backslash in Linux and shell script
The backslash (\) is called the escape character. If we use \X then character X has the quoting effect. So \X is equivalent to 'X' But with echo and sed command backslash with certain character may have the special meaning.
For example,

\n means newline

\r means return

\t means tab

\v means vertical tab

\b means backspace

\a means alert (beep or flash)

Related Documents

Friday, October 2, 2009

Single quote, double quote and comma in shell script

- Single quotes are called the full quoting mechanism. Anything you write within single quote it preserves all special characters within single quote. So within single quote it does not do any variable substitution.
Example of single quote:

$ cat >single_quote.sh
echo 'Process ID variable is defined by $$'
echo 'Exit status is defined by $?'

$ sh single_quote.sh
Process ID variable is defined by $$
Exit status is defined by $?

Here the special characters are preserved as they are written inside single quote.

- Double quotes are called partial quoting mechanism. Anything you write within double quote it interprets most of the special characters within double quote.
Example of double quote:

$ cat >double_quote.sh

echo "Process ID variable is defined by $$"
echo "Exit status is defined by $?"

$ sh double_quote.sh
Process ID variable is defined by 5256
Exit status is defined by 0

Note that $$ and $? is interpreted.

- Comma(,) operator chains together two or more arithmetic operations. All the operations are evaluated but only the last one is returned.
Example:

let "t1 = ((a = 9, 3 + 2, 2 - 1, 15 - 4))"
echo "t1 = $t1" # t1 = 11
# Here t1 is set to the result of the last operation that is 11. variable a=9

let "t2 = ((a = 9, 15 / 3))" # Set "a" and calculate "t2".
echo "t2 = $t2 a = $a" # t2 = 5 a = 9

- In case of parameter substitution single comma is used to make first character as lowercase and double comma is used to make all characters are lowercase.

Example:

$ cat >lower_upper.sh
var=mixEdCasecharacteR
echo ${var}
echo ${var,}
# * First char --> lowercase.
echo ${var,,}
# ** All chars --> lowercase.
echo ${var^}
# * First char --> uppercase.
echo ${var^^}
# ** All chars --> uppercase.

Note that above example is application only for on and after of version 4 of Bash.
Related Documents

Dot (.) in linux and shell script

- Dot(.) is equivalent the source command in shell script and linux command line. From command line we can execute a shell script using dot (.). Within a script, a "source file_name" or ". file_name" loads the file file_name. The command "source" or "." just imports code into the script, appending to the script (it is same like include command in php or #include in c). The net result is the same as if the "sourced" lines of code were physically present in the body of the script. This technique is useful in situations when multiple scripts use a common data file or function library.

Let's assume that my welcome.sh is like below which later included using . within main.sh file.

$ cat >welcome.sh
echo "Welcome to shell script programing"

$ cat >main.sh
. welcome.sh
echo "This is main file"

$ sh main.sh
Welcome to shell script programing
This is main file


- Dot (.) is the part of the hidden file name. A leading dot is the prefix of a "hidden" file.

$ ls
main.sh newfile semicolon_test.sh welcome.sh

$ touch .hidden_file

$ ls
main.sh newfile semicolon_test.sh welcome.sh

$ ls -a
. .. .hidden_file main.sh newfile semicolon_test.sh welcome.sh


In the example ls -a shows the hidden file .hidden_file

- When working with directory, a single dot (.) represents the current working directory, and two dots (..) represent the parent directory.
Example:

$ pwd
/home/Arju/t_dir

$ cd .

$ pwd
/home/Arju/t_dir

$ cd ..

$ pwd
/home/Arju


- While copying files we can use dot (.) to represent current directory.
The following example will copy the file /home/Arju/f to present working directory.

$ cp /home/Arju/f .


- In case of regular expression while matching characters, a "dot" matches a single character. About dot (.) it is discussed in http://arjudba.blogspot.com/2009/07/list-of-metacharacters-in-regular.html

Related Documents

Thursday, October 1, 2009

Semicolon (;) and double semicolon (;;) in shell script

- Semicolon in shell script often called command separator. In shell script each separate command need to be placed in each separate line. However, if we want to put two or more separate commands into one line then between them we need to place semicolon (;).
Following is a script which will explain the usage of semicolon. If there file exist then script delete the file and if file does not exist then it simply create the file.

$ cat >semicolon_test.sh
echo first command; echo second command
if [ -f newfile ]; then
echo "file exists"; rm newfile
else
echo "File not exists"; touch newfile
fi; echo "Script is done."

$ sh semicolon_test.sh
first command
second command
File not exists
Script is done.

$ ls
newfile semicolon_test.sh

$ sh semicolon_test.sh
first command
second command
file exists
Script is done.

$ ls
semicolon_test.sh


- Note that sometimes while using semicolon we need to escape semicolon. An example is,

find $PROCESSED_DIR -type f -mtime +30 -exec rm {} \;

The '\' ensures that the ';' is interpreted literally, as end of command.
Combination of "\;" at the end tells "find" where the end of the -exec command is. It can't just be the end of the line because the find command syntax allows further tests and actions after the -exec and it can't be just ; because the shell would see it as the end of a shell command and remove it. The \ "escapes" it from being seen by the shell as the end of a shell command.

- Double semicolon (;;) is used as a terminator of case option which is exampled in the topic http://arjudba.blogspot.com/2009/04/case-statement-in-shell-script.html.

- Double semicolon + ampersand (;;&, ;&) is used as terminators in a case option in version 4+ of Bash.

Related Documents

Hash sign (#) in shell script

- With the exception of #! if the line is started by the hash sign then that line in shell script is considered as comment and hence that line is ignored during execution of shell script.

So, a simple example of shell script comment is,

# This line is considered as comment in shell script.


Note that if the first line of the shell script begins with #! then the script tells your system that this file is a set of commands to be fed to the command interpreter indicated and it is not a comment then which is discussed inside topic What is sharp-bang appear at first inside shell script.

- Comment can also appear at the end of the command provided that there is a whitespace before the hash. If there is no whitespace before the hash then comment becomes part of the command.
Following is an example.

$ cat comment_test.sh
echo "This is a comment"#comment

$ sh comment_test.sh
This is a comment#comment

$ cat comment_test.sh
echo "This is a comment" #comment

$ sh comment_test.sh
This is a comment

- Comment also allow whitespace before starting a line.

# This comment is preceded with tab


- Comment can also be embedded within a pipe.

var=( `cat "$filename" | sed -e '/#/d' | tr -d '\n' |\
# Delete lines containing '#' comment character.
sed -e 's/\./\. /g'` )


- In the same line after comment commands are not allowed. As in a line there is no way to terminate comment once it is started so any command after comment will be treated as comment. So for command we need to put it in the new line.

- Note that if hash sign appears within quotes (may be single quote ' or double quote ") or after escape characters ( that is after backslash \ ) then that is not considered as comment.

Also in case of parameter-substitution constructs and in numerical constant expressions. So if we write hash in the way of ${#*}, ${#@}, ${#var} or $(( 2#101 ))
then # is not considered as comment.

echo "The # does not begin a comment."
echo 'The # does not begin a comment.'
echo The \# does not begin a comment.
echo The # begins a comment here.

echo ${PAR#*:} # Parameter substitution, not a comment.
echo $(( 2#1010 )) # Base conversion, not a comment.


- In case of pattern matching operations like ${var/#Pattern/Replacement} (If prefix of var matches Pattern, then substitute Replacement for Pattern.) # is not considered as comment rather it is matched at prefix (beginning) of string.
Related Documents
1. Introduction -What is kernel, shell, shell script.
2. Basic Steps to write a shell script
3. Variables in shell script
4. Output text with echo command
5. Arithmetic operation and expression in shell script with expr
6. Basic shell programming commands quote, exit and read
7. Wildcard characters in linux
8. Assignment and comparison variable in shell script
9. Command writing, command line arguments in shell script
10. Input-Output rediection on linux
11. Pipe with example in linux