Re: Bash script - how do I modify varible data with another varible?

Originally Posted by
bakegoodz
I'm building a bash script with the help of the book I bought. I can't find the syntax to accomplish one part of it. I have a variable "part" that is always 4 characters, three letters and one number at the end, example sda1 (yes it is a hard drive). I want the take the number and add it to another variable with just 3 letters. For example take variable "target" with data sdb and modify it to be sdb1, with the number from variable "part"
what is a simple way to express this in bash syntax?
target=$target`echo $part | cut -c4`
there are 10 types of people in the world: those that understand binary and i don't know who the other F are.
Bookmarks