What language does the Konsole window run and what does it do?… here is a solution to the problem.
What language does the Konsole window run and what does it do?
How do I store the result of an expression in a variable?
echo "hello" > var1
Can I do something like this too?
var1.substring(10,15); var1.replace('hello', '2'); var1.indexof('hello')
Postscript. I have tried to google search but without success.
Solution
As @larsmans commented, Konsole
is a terminal emulator that in turn runs a shell.
On Linux, this is usually bash
, but it can also be something else.
Find out which shell you are using and print the man page.
echo $SHELL # shows the full path to the shell
man ${SHELL##*/} # use the rightmost part (typically bash, in linux)
For a general introduction, use wikipedia entry on the Unix shell or GNU Bash refererence
Some specific answers:
var1="hello"
echo ${var1:0:4} # prints "hell"
echo ${var1/hello/2} # prints "2" -- replace "hello" with "2"
At the risk of showing off:
index_of() { (t=${1%%$2*} && echo ${#t}); } # define function index_of
index_of "I say hello" hello
6
But this goes beyond simple shell programming.