Reputation: 539
I need to split the file path/directory and use it as an argument using shell script.
I have a file path: /home/ubuntu/testscriptsfolder/jmx/*.jmx
and need to get only *.jmx
in my variable so that I can pass it as an argument in one of my run commands.
Please suggest how it is achievable in shell script.
Upvotes: 0
Views: 458
Reputation: 2402
These commands are useful for that:
$ basename /path/to/name
name
$ dirname /path/to/name
/path/to
Upvotes: 2