当前位置: 动力学知识库 > 问答 > 编程问答 >

bash - How can I access command line arguments indexed from the end?

问题描述:

How can I get second argument from the end of arguments line in bash?

网友答案:

one way in Bash

set -- ${@:(-2)}
echo $1

or simply

echo ${@:(-2):1}
网友答案:

To print the second last argument use:

echo "${@:(-2):1}"
分享给朋友:
您可能感兴趣的文章:
随机阅读: