I am trying to use the cut command in my bash script. I need to get the name of a rpm package containing 'sys' in its name, without its full path. So I tried this:
packageName=$(find temp/noarch/ -name '*sys*noarch.rpm' | cut -d "\/" -f 3)
I thought this way could return the package's name without the temp/noarch/, but it only tells me.
I know i could just remove the substring "temp\/noarch\/"
, but i'd like to make it with cut.
"\/"
doesn't expand to /
, so cut
complains:
cut: the delimiter must be a single character
Use plain /
instead:
packageName=$(find temp/noarch/ -name '*sys*noarch.rpm' | cut -d/ -f3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With