문제

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