Shell combining Parameter Expansion

Viewed 40

I have the 3 lines of code. How can they best combined possibly into only one call without pushing the results always into the variable.

value=$(echo $value) #eliminates LF
value=${value//\"}
value="\"${value%% *}\""

Update:

a string which look like that . (The quotes in the string will be used to be pushed in another JSON structure where it has to be quoted. But as the input for $values is already quoted, there is no need to eliminate the quotes to add them later again.)

""643 645,Segment1_System3""

should be converted into

""643""

only if $value does not pop up right as ""643""

0 Answers
Related