add the old snippet md files
This commit is contained in:
parent
fc0dd204c7
commit
bcf8313a4b
110 changed files with 3048 additions and 0 deletions
38
old_snippets/bash-extract-file-name.en.md
Normal file
38
old_snippets/bash-extract-file-name.en.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: "bash extract file name"
|
||||
seo_description: "How to use basename command to extract just file name from full path"
|
||||
date: 2022-03-17T15:08:43+01:00
|
||||
draft: false
|
||||
snippet_types:
|
||||
- sh
|
||||
- bash
|
||||
---
|
||||
|
||||
Comparing the following shows how to use basename to extract just the file name from a full path.
|
||||
|
||||
```shell
|
||||
$ for file in ./content/**/*.md ; do echo $file ; done | head -10
|
||||
./content/_index.de.md
|
||||
./content/_index.en.md
|
||||
./content/_index.ru.md
|
||||
./content/blog/_index.de.md
|
||||
./content/blog/_index.en.md
|
||||
./content/blog/ahrn-valley/index.en.md
|
||||
./content/blog/archiving-corona-cal/index.en.md
|
||||
./content/blog/arco/index.de.md
|
||||
./content/blog/arco/index.en.md
|
||||
./content/blog/armycookbot/index.de.md
|
||||
|
||||
|
||||
$ for file in ./content/**/*.md ; do file=$(basename $file) && echo $file ; done
|
||||
_index.de.md
|
||||
_index.en.md
|
||||
_index.ru.md
|
||||
_index.de.md
|
||||
_index.en.md
|
||||
index.en.md
|
||||
index.en.md
|
||||
index.de.md
|
||||
index.en.md
|
||||
index.de.md
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue