0

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?

0

1 Answer 1

2

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]...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.