https://github.com/nichoth/bash
bash notes
https://github.com/nichoth/bash
Last synced: 6 months ago
JSON representation
bash notes
- Host: GitHub
- URL: https://github.com/nichoth/bash
- Owner: nichoth
- Created: 2015-07-14T16:37:47.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-15T23:43:56.000Z (about 11 years ago)
- Last Synced: 2025-03-10T06:38:25.675Z (over 1 year ago)
- Size: 113 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# bash notes
List some directories and copy to clipboard all on one line
```bash
ls .. | grep something | tr '\n' ' ' | pbcopy
```
Get the basename for a file (remove the path):
${PATHNAME##*/}
for loop
```bash
for file in `ls`;
do
echo "$file";
done
```
Create a file in each directory.
```bash
ls | xargs -I dir touch dir/text.txt
```