Last active
February 11, 2024 22:41
-
-
Save psenger/9bbbf66deaf2dd85d919fe46241c0df4 to your computer and use it in GitHub Desktop.
[Find files use basename extract the file name or extension ] #UNIX #find
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## with this example, I can auto create the spec files based on functions | |
| for item in `find ./src/controllers/external -type f` | |
| do | |
| FILENAME=`basename -s .js $item` | |
| touch ./test/controllers/external/$FILENAME.spec.js | |
| done | |
| ## --------------------- | |
| ## basename ./src/controllers/external/storeApi.js | |
| ## storeApi.js | |
| ## --------------------- | |
| ## basename -s .js ./src/controllers/external/storeApi.js | |
| ## storeApi | |
| ## --------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment