For example, I have a string, " some string", and I want to put "some string" in another string variable. How do I do that?
My code:
function get_title() {
t1=$(get_type "$1")
t2="ACM Transactions"
t3="ELSEVIER"
t4="IEEE Transactions"
t5="MIT Press"
if [ "$t1"=="$t2" ];
then
title=$(less "$1" | head -1)
elif [ "$t1"=="$t5" ];
then
title=$(less "$1" | head -3)
fi
echo "$title"
}
As you can see the $title can return unwanted whitespace in front of text in center aligned texts. I want to prevent that.