Вопрос

I defined $A that has the value A12 (for example ). how do I pass that value to the location that has XXX in the command :

ls -dtr XXX_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] | sort -n | tail -1

the XXX_[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] is actually a folder name format (a12_20130233)

is there a way to pass it?

Это было полезно?

Решение

Normally it would be as simple as $A but because the following character (an underscore in this case) can be interpreted as part of the variable name, it needs to be delimited with {}, like so:

ls -dtr ${A}_[0-9]...
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top