Bash: manipulating with strings (percent sign) -
what percent sign mean in bash when manipulating strings? example, ${0%/*}
mean?
if use @fedorqui's resource, you'll see going strip shortest match of /*
end of first positional argument. example:
example_foo(){ echo ${1%/*} } example_foo path/to/directory/sub_directory # => path/to/directory
in example used second positional argument since first name of function.
Comments
Post a Comment