Hi all
I am confused .
When SUSE linux is loaded in an embedded
bord , how usual controlcommands are writen
like IF, WHILE, SWITCH .
Does LINUX offer such commands ?
If yes where online SUSE commands ore offered
for refference ?
Elico
Printable View
Hi all
I am confused .
When SUSE linux is loaded in an embedded
bord , how usual controlcommands are writen
like IF, WHILE, SWITCH .
Does LINUX offer such commands ?
If yes where online SUSE commands ore offered
for refference ?
Elico
those commands are typically built-in functions of a shell, such as Bash or C-Shell. for example, you could write a bash script using some of those functions like this:
copy that code to a file, e.g., named "test.sh", make it executable:Code:#!/bin/bash
max=5
i=1
while [ $i -le $max ]; do
echo $i
if [ $i -eq $max ]; then
echo This is the end
fi
i=$(( $i + 1 ))
sleep 1
done
then execute it:Code:chmod +x ./test.sh
To read more on the functions in Bash, read the man page:Code:./test.sh
The switch function is available in the C-shell (csh, tcsh, etc.), although you can emulate the functionality in bash. Read up on it in the tcsh man page:Code:man bash
Code:man tcsh
In case of C language code is writen and cross compiled
to deploy on the linux based board, how LINUX threads and tasks
are includded in that C code ?
do we include LINUX heder files at design time in the C code ?
Elico
Okay, C programming. There is lots of documentation for that at your disposal. See this GNU article on using the getopt function, which also displays the switch function in action:
Example of Getopt - The GNU C Library
At the top of the example program there, you will see header include files at the top of the code, containing functions, etc. called within the program.
Thanks
Elico