Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Question
In linux, you have parameter TEXT with value "hithere", print out just the substring "the" from TEXT.
Answer

echo ${TEXT:2:3}

^^ note the special use of parameter expansion above

^^^ note that the first number, 2, is the starting index of string to start the substring from, and the second number, 3, is the length of substring. THIS IS DIFFERENT THAN PYTHON.

^^^^ To go to the end of substing, if you don't know length, just choose a very large length value, e.g. echo ${TEXT:2:20000}


Question
In linux, you have parameter TEXT with value "hithere", print out just the substring "the" from TEXT.
Answer
?

Question
In linux, you have parameter TEXT with value "hithere", print out just the substring "the" from TEXT.
Answer

echo ${TEXT:2:3}

^^ note the special use of parameter expansion above

^^^ note that the first number, 2, is the starting index of string to start the substring from, and the second number, 3, is the length of substring. THIS IS DIFFERENT THAN PYTHON.

^^^^ To go to the end of substing, if you don't know length, just choose a very large length value, e.g. echo ${TEXT:2:20000}

If you want to change selection, open document below and click on "Move attachment"

20. Advanced Shell Scripting
behavior of ${ VAR :- default } . ${ VAR :? message } This will result in $ VAR unless VAR is unset or null, in which case an error message containing message is displayed. ${ VAR : offset } or <span>${ VAR : n : l } This produces the nth character of $ VAR and then the following l characters. If l is not present, then all characters to the right of the nth character are produced. This is useful for

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.