Use MarkdownExec to interactively select and execute fenced code blocks in markdown files.
The ["MarkdownExec (MDE)"](https://github.com/fareedst/markdownexec) application is a tool for executing `bash` code blocks extracted from Markdown (MD) documents. MDE operates in a Ruby and Ubuntu environment, employing Bash for noscript execution.
**Platform Specifications:**
- **Base Platform:** Ruby for Ubuntu systems.
- **Shell Integration:** Incorporates Bash for executing noscripts.
- **Configuration and Metadata Management:** Utilizes YAML for managing configuration and metadata.
- **User Interface:** Boasts a terminal interface with ANSI colors for enhanced readability and engagement.
**Core Functionalities:**
1. **LLM Output Integration:** MDE adeptly reads MD files from LLMs, focusing on identifying and processing `bash` fenced code blocks.
2. **Document Processing and Menu Interface:** Transforms MD text into an accessible format. It distinguishes fenced code blocks, converting them into interactive menu items akin to hyperlinks for straightforward navigation.
3. **Interactive User Experience:** Offers keyboard navigation within the menu, enabling users to execute desired blocks by selecting relevant menu items.
4. **Script Execution and Output Display:** Executes chosen noscripts and presents outputs, utilizing ANSI colors for distinction and emphasis. The menu dynamically updates to reflect changes post-execution.
5. **Application Use Cases:** Suited for executing automated noscripts from LLM recommendations, serving as an interactive educational platform, and assisting developers in rapid prototyping.
6. **Automated Execution via Command Line Arguments:**
- MDE supports automated operation by specifying the document and block names in command-line arguments.
- Designated blocks are executed in order, encompassing navigation and execution within new documents accessed via links or imports.
- When block names are specified, MDE automatically concludes operations post-execution, optimizing batch processes and automation.
**Extended Functionalities:**
1. **Block Naming and Dependencies:**
- Fenced code blocks are identified by type (`bash`) and unique names for effortless referencing.
- MDE accommodates dependencies among code blocks, facilitating execution of prerequisite noscripts before the target noscript.
2. **Code Block Reusability and Document Navigation:**
- **@import Directive:** MDE features an "@import" directive to boost code reusability, allowing the insertion of blocks from other documents at the directive's location, fostering modular coding.
- **Link Block Type:** MDE integrates a "link" block type for seamless document navigation. Execution of this block shifts focus to the specified file, as shown below:
```link :gotomenu
file: menu.md
```
**Customization and Configuration:**
- MDE allows extensive customization, including numerous options for matching source document text, formatting, and coloring output, and personalizing the MDE interface.
- Users can configure MDE settings via configuration files, environment variables, program arguments, and within markdown documents.
**Configuration Sources:**
1. **Environment Variables:** MDE reads the current environment, including configuration in the current and child shells and the current command.
2. **Configuration Files:** MDE accommodates configurations in all shells and supports a dedicated `.mde.yml` file in the current folder, or a specified YAML file.
3. **Program Arguments:** Users can set options directly through command arguments.
4. **Opts Fenced Code Blocks:** MDE recognizes configuration in `opts` blocks, applying settings when the document is loaded or blocks are executed.
**Example Markdown Document:**
These blocks illustrate the use of named and dependent `bash` code blocks and the `link` block type.
```bash :initializeenvironment
# Initial environment setup commands
echo "Initializing environment..."
The ["MarkdownExec (MDE)"](https://github.com/fareedst/markdownexec) application is a tool for executing `bash` code blocks extracted from Markdown (MD) documents. MDE operates in a Ruby and Ubuntu environment, employing Bash for noscript execution.
**Platform Specifications:**
- **Base Platform:** Ruby for Ubuntu systems.
- **Shell Integration:** Incorporates Bash for executing noscripts.
- **Configuration and Metadata Management:** Utilizes YAML for managing configuration and metadata.
- **User Interface:** Boasts a terminal interface with ANSI colors for enhanced readability and engagement.
**Core Functionalities:**
1. **LLM Output Integration:** MDE adeptly reads MD files from LLMs, focusing on identifying and processing `bash` fenced code blocks.
2. **Document Processing and Menu Interface:** Transforms MD text into an accessible format. It distinguishes fenced code blocks, converting them into interactive menu items akin to hyperlinks for straightforward navigation.
3. **Interactive User Experience:** Offers keyboard navigation within the menu, enabling users to execute desired blocks by selecting relevant menu items.
4. **Script Execution and Output Display:** Executes chosen noscripts and presents outputs, utilizing ANSI colors for distinction and emphasis. The menu dynamically updates to reflect changes post-execution.
5. **Application Use Cases:** Suited for executing automated noscripts from LLM recommendations, serving as an interactive educational platform, and assisting developers in rapid prototyping.
6. **Automated Execution via Command Line Arguments:**
- MDE supports automated operation by specifying the document and block names in command-line arguments.
- Designated blocks are executed in order, encompassing navigation and execution within new documents accessed via links or imports.
- When block names are specified, MDE automatically concludes operations post-execution, optimizing batch processes and automation.
**Extended Functionalities:**
1. **Block Naming and Dependencies:**
- Fenced code blocks are identified by type (`bash`) and unique names for effortless referencing.
- MDE accommodates dependencies among code blocks, facilitating execution of prerequisite noscripts before the target noscript.
2. **Code Block Reusability and Document Navigation:**
- **@import Directive:** MDE features an "@import" directive to boost code reusability, allowing the insertion of blocks from other documents at the directive's location, fostering modular coding.
- **Link Block Type:** MDE integrates a "link" block type for seamless document navigation. Execution of this block shifts focus to the specified file, as shown below:
```link :gotomenu
file: menu.md
```
**Customization and Configuration:**
- MDE allows extensive customization, including numerous options for matching source document text, formatting, and coloring output, and personalizing the MDE interface.
- Users can configure MDE settings via configuration files, environment variables, program arguments, and within markdown documents.
**Configuration Sources:**
1. **Environment Variables:** MDE reads the current environment, including configuration in the current and child shells and the current command.
2. **Configuration Files:** MDE accommodates configurations in all shells and supports a dedicated `.mde.yml` file in the current folder, or a specified YAML file.
3. **Program Arguments:** Users can set options directly through command arguments.
4. **Opts Fenced Code Blocks:** MDE recognizes configuration in `opts` blocks, applying settings when the document is loaded or blocks are executed.
**Example Markdown Document:**
These blocks illustrate the use of named and dependent `bash` code blocks and the `link` block type.
```bash :initializeenvironment
# Initial environment setup commands
echo "Initializing environment..."
bash :dataprocessing +initializeenvironment
Use Markdown_Exec to interactively select and execute fenced code blocks in markdown files.
The ["Markdown_Exec (MDE)"](https://github.com/fareedst/markdown_exec) application is a tool for executing `bash` code blocks extracted from Markdown (MD) documents. MDE operates in a Ruby and Ubuntu environment, employing Bash for noscript execution.
**Platform Specifications:**
- **Base Platform:** Ruby for Ubuntu systems.
- **Shell Integration:** Incorporates Bash for executing noscripts.
- **Configuration and Metadata Management:** Utilizes YAML for managing configuration and metadata.
- **User Interface:** Boasts a terminal interface with ANSI colors for enhanced readability and engagement.
**Core Functionalities:**
1. **LLM Output Integration:** MDE adeptly reads MD files from LLMs, focusing on identifying and processing `bash` fenced code blocks.
2. **Document Processing and Menu Interface:** Transforms MD text into an accessible format. It distinguishes fenced code blocks, converting them into interactive menu items akin to hyperlinks for straightforward navigation.
3. **Interactive User Experience:** Offers keyboard navigation within the menu, enabling users to execute desired blocks by selecting relevant menu items.
4. **Script Execution and Output Display:** Executes chosen noscripts and presents outputs, utilizing ANSI colors for distinction and emphasis. The menu dynamically updates to reflect changes post-execution.
5. **Application Use Cases:** Suited for executing automated noscripts from LLM recommendations, serving as an interactive educational platform, and assisting developers in rapid prototyping.
6. **Automated Execution via Command Line Arguments:**
- MDE supports automated operation by specifying the document and block names in command-line arguments.
- Designated blocks are executed in order, encompassing navigation and execution within new documents accessed via links or imports.
- When block names are specified, MDE automatically concludes operations post-execution, optimizing batch processes and automation.
**Extended Functionalities:**
1. **Block Naming and Dependencies:**
- Fenced code blocks are identified by type (`bash`) and unique names for effortless referencing.
- MDE accommodates dependencies among code blocks, facilitating execution of prerequisite noscripts before the target noscript.
2. **Code Block Reusability and Document Navigation:**
- **@import Directive:** MDE features an "@import" directive to boost code reusability, allowing the insertion of blocks from other documents at the directive's location, fostering modular coding.
- **Link Block Type:** MDE integrates a "link" block type for seamless document navigation. Execution of this block shifts focus to the specified file, as shown below:
```link :go_to_menu
file: menu.md
```
**Customization and Configuration:**
- MDE allows extensive customization, including numerous options for matching source document text, formatting, and coloring output, and personalizing the MDE interface.
- Users can configure MDE settings via configuration files, environment variables, program arguments, and within markdown documents.
**Configuration Sources:**
1. **Environment Variables:** MDE reads the current environment, including configuration in the current and child shells and the current command.
2. **Configuration Files:** MDE accommodates configurations in all shells and supports a dedicated `.mde.yml` file in the current folder, or a specified YAML file.
3. **Program Arguments:** Users can set options directly through command arguments.
4. **Opts Fenced Code Blocks:** MDE recognizes configuration in `opts` blocks, applying settings when the document is loaded or blocks are executed.
**Example Markdown Document:**
These blocks illustrate the use of named and dependent `bash` code blocks and the `link` block type.
```bash :initialize_environment
# Initial environment setup commands
echo "Initializing environment..."
```
```bash :data_processing +initialize_environment
The ["Markdown_Exec (MDE)"](https://github.com/fareedst/markdown_exec) application is a tool for executing `bash` code blocks extracted from Markdown (MD) documents. MDE operates in a Ruby and Ubuntu environment, employing Bash for noscript execution.
**Platform Specifications:**
- **Base Platform:** Ruby for Ubuntu systems.
- **Shell Integration:** Incorporates Bash for executing noscripts.
- **Configuration and Metadata Management:** Utilizes YAML for managing configuration and metadata.
- **User Interface:** Boasts a terminal interface with ANSI colors for enhanced readability and engagement.
**Core Functionalities:**
1. **LLM Output Integration:** MDE adeptly reads MD files from LLMs, focusing on identifying and processing `bash` fenced code blocks.
2. **Document Processing and Menu Interface:** Transforms MD text into an accessible format. It distinguishes fenced code blocks, converting them into interactive menu items akin to hyperlinks for straightforward navigation.
3. **Interactive User Experience:** Offers keyboard navigation within the menu, enabling users to execute desired blocks by selecting relevant menu items.
4. **Script Execution and Output Display:** Executes chosen noscripts and presents outputs, utilizing ANSI colors for distinction and emphasis. The menu dynamically updates to reflect changes post-execution.
5. **Application Use Cases:** Suited for executing automated noscripts from LLM recommendations, serving as an interactive educational platform, and assisting developers in rapid prototyping.
6. **Automated Execution via Command Line Arguments:**
- MDE supports automated operation by specifying the document and block names in command-line arguments.
- Designated blocks are executed in order, encompassing navigation and execution within new documents accessed via links or imports.
- When block names are specified, MDE automatically concludes operations post-execution, optimizing batch processes and automation.
**Extended Functionalities:**
1. **Block Naming and Dependencies:**
- Fenced code blocks are identified by type (`bash`) and unique names for effortless referencing.
- MDE accommodates dependencies among code blocks, facilitating execution of prerequisite noscripts before the target noscript.
2. **Code Block Reusability and Document Navigation:**
- **@import Directive:** MDE features an "@import" directive to boost code reusability, allowing the insertion of blocks from other documents at the directive's location, fostering modular coding.
- **Link Block Type:** MDE integrates a "link" block type for seamless document navigation. Execution of this block shifts focus to the specified file, as shown below:
```link :go_to_menu
file: menu.md
```
**Customization and Configuration:**
- MDE allows extensive customization, including numerous options for matching source document text, formatting, and coloring output, and personalizing the MDE interface.
- Users can configure MDE settings via configuration files, environment variables, program arguments, and within markdown documents.
**Configuration Sources:**
1. **Environment Variables:** MDE reads the current environment, including configuration in the current and child shells and the current command.
2. **Configuration Files:** MDE accommodates configurations in all shells and supports a dedicated `.mde.yml` file in the current folder, or a specified YAML file.
3. **Program Arguments:** Users can set options directly through command arguments.
4. **Opts Fenced Code Blocks:** MDE recognizes configuration in `opts` blocks, applying settings when the document is loaded or blocks are executed.
**Example Markdown Document:**
These blocks illustrate the use of named and dependent `bash` code blocks and the `link` block type.
```bash :initialize_environment
# Initial environment setup commands
echo "Initializing environment..."
```
```bash :data_processing +initialize_environment
GitHub
GitHub - fareedst/markdown_exec: Interactively select and execute fenced code blocks in markdown files. Build complex noscripts by…
Interactively select and execute fenced code blocks in markdown files. Build complex noscripts by naming and requiring blocks. Log resulting noscripts and output. Re-run noscripts. - GitHub - fareedst/ma...
# Data processing commands requiring initialized environment
echo "Processing data..."
```
```link :go_to_menu
file: menu.md
```
In this example, the `data_processing` block relies on `initialize_environment`. When selecting `data_processing`, MDE first executes `initialize_environment` to ensure proper setup before proceeding. The `link` block type enables navigation to `menu.md`, offering a structured and interconnected document system. These attributes make MDE an effective tool for managing complex noscript sequences and various applications. The automated execution feature via command-line arguments further enhances MDE's role in batch processing and workflow automation.
https://redd.it/18r1ygi
@r_bash
echo "Processing data..."
```
```link :go_to_menu
file: menu.md
```
In this example, the `data_processing` block relies on `initialize_environment`. When selecting `data_processing`, MDE first executes `initialize_environment` to ensure proper setup before proceeding. The `link` block type enables navigation to `menu.md`, offering a structured and interconnected document system. These attributes make MDE an effective tool for managing complex noscript sequences and various applications. The automated execution feature via command-line arguments further enhances MDE's role in batch processing and workflow automation.
https://redd.it/18r1ygi
@r_bash
Reddit
From the bash community on Reddit: Use Markdown_Exec to interactively select and execute fenced code blocks in markdown files.
Explore this post and more from the bash community
How can i create a new file and run it afterwards without having to chmod it every time?
ive read i can add umask 011 in my zshrc but im still getting the permission issue even though im root.
https://redd.it/18ux7jz
@r_bash
ive read i can add umask 011 in my zshrc but im still getting the permission issue even though im root.
https://redd.it/18ux7jz
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Identifying and then moving folders with only zero-length files?
I have been trying to use Mac Automator with bash shell noscripts to assist with some time consuming file management. One part of the workflow has got me stuck. I've tried asking ChatGPT which has proposed some code, but it either doesn't work at all, or works with errors. Grateful for any advice.
This is my situation:
* I have output\_directory that is full of folders. These folders contain files and sometimes also have multiple layers of sub-folders with files within.
* As part of a space-saving and depulication-prevention workflow, some files have been truncated to 0kb while preserving filename and location. This is done using the Mac terminal command: "find . -type f -exec truncate -s 0 {} \\;"
* I want to identify folders that are comprised ONLY of 0kb files (and any associated sub-folders) and move these entire folders to empty\_folders\_directory. File structure within the moved folder should be maintained.
* If a folder has a mix of 0kb files and non-0kb files the folder should remain in output\_directory.
I'm not quite sure why the code(s) I've tried haven't worked e.g.:
# Check if the folder contains only empty files
if [ -z "$(find "$output_directory/$(basename "$folder")" -mindepth 1 -type f -exec test -s {} \;)" ]; then
# Move the folder to the !empty_folders directory
mv "$output_directory/$(basename "$folder")" "$empty_folders_directory"
echo "Moved $folder to $empty_folders_directory"
e.g.
# Check if there are non-zero-length files within the folder (including sub-folders)
zero_length_files=$(find "$output_directory/$(basename "$folder")" -type f -size +0c)
if [ -z "$zero_length_files" ]; then
mv "$output_directory/$(basename "$folder")" "$zero_kb_directory"
echo "Moved $folder to $zero_kb_directory"
And this example where ChatGPT did this step of the process as a function within an earlier part of the workflow that sorts folders depending on file-extensions present on folder contents:
#!/bin/bash
input_directory="/Users/rj/autotest/testinputdirectory"
output_directory="/Users/rj/autotest/testoutputdirectory"
empty_folders_directory="/Users/rj/autotest/testoutputdirectory/!empty_folders"
# Function to check if a folder and its sub-folders contain only empty files
check_empty_folder() {
local folder="$1"
# Check if the folder contains only empty files
if [ -z "$(find "$folder" -type f -exec test -s {} \;)" ]; then
return 0 # Folder contains only empty files
else
return 1 # Folder contains non-empty files
fi
}
# Loop through each folder in the input directory
for folder in "$input_directory"/*; do
# Check if the folder contains files with ".downloading" or ".prog" extensions
if [ -n "$(find "$folder" -type f \( -name "*.downloading" -o -name "*.prog" \))" ]; then
echo "Skipping $folder"
else
# Move the whole folder to the output directory
mv "$folder" "$output_directory"
echo "Moved $folder to $output_directory"
# Check if the folder and its sub-folders contain only empty files
if check_empty_folder "$output_directory/$(basename "$folder")"; then
# Move the folder to the !empty_folders directory
mv "$output_directory/$(basename "$folder")" "$empty_folders_directory"
echo "Moved $folder to $empty_folders_directory"
fi
fi
done
I've tried the above as well as lots of variants. They either haven't worked at all (i.e. empty\_folders\_directory has nothing it it when it should); or have worked incompletely e.g.: some folders haven't been moved; or contents of folders end up in the root of empty\_folders\_directory (which should never be the case).
Any pointers mucha appreciated.
Thanks
https://redd.it/18v4vbt
@r_bash
I have been trying to use Mac Automator with bash shell noscripts to assist with some time consuming file management. One part of the workflow has got me stuck. I've tried asking ChatGPT which has proposed some code, but it either doesn't work at all, or works with errors. Grateful for any advice.
This is my situation:
* I have output\_directory that is full of folders. These folders contain files and sometimes also have multiple layers of sub-folders with files within.
* As part of a space-saving and depulication-prevention workflow, some files have been truncated to 0kb while preserving filename and location. This is done using the Mac terminal command: "find . -type f -exec truncate -s 0 {} \\;"
* I want to identify folders that are comprised ONLY of 0kb files (and any associated sub-folders) and move these entire folders to empty\_folders\_directory. File structure within the moved folder should be maintained.
* If a folder has a mix of 0kb files and non-0kb files the folder should remain in output\_directory.
I'm not quite sure why the code(s) I've tried haven't worked e.g.:
# Check if the folder contains only empty files
if [ -z "$(find "$output_directory/$(basename "$folder")" -mindepth 1 -type f -exec test -s {} \;)" ]; then
# Move the folder to the !empty_folders directory
mv "$output_directory/$(basename "$folder")" "$empty_folders_directory"
echo "Moved $folder to $empty_folders_directory"
e.g.
# Check if there are non-zero-length files within the folder (including sub-folders)
zero_length_files=$(find "$output_directory/$(basename "$folder")" -type f -size +0c)
if [ -z "$zero_length_files" ]; then
mv "$output_directory/$(basename "$folder")" "$zero_kb_directory"
echo "Moved $folder to $zero_kb_directory"
And this example where ChatGPT did this step of the process as a function within an earlier part of the workflow that sorts folders depending on file-extensions present on folder contents:
#!/bin/bash
input_directory="/Users/rj/autotest/testinputdirectory"
output_directory="/Users/rj/autotest/testoutputdirectory"
empty_folders_directory="/Users/rj/autotest/testoutputdirectory/!empty_folders"
# Function to check if a folder and its sub-folders contain only empty files
check_empty_folder() {
local folder="$1"
# Check if the folder contains only empty files
if [ -z "$(find "$folder" -type f -exec test -s {} \;)" ]; then
return 0 # Folder contains only empty files
else
return 1 # Folder contains non-empty files
fi
}
# Loop through each folder in the input directory
for folder in "$input_directory"/*; do
# Check if the folder contains files with ".downloading" or ".prog" extensions
if [ -n "$(find "$folder" -type f \( -name "*.downloading" -o -name "*.prog" \))" ]; then
echo "Skipping $folder"
else
# Move the whole folder to the output directory
mv "$folder" "$output_directory"
echo "Moved $folder to $output_directory"
# Check if the folder and its sub-folders contain only empty files
if check_empty_folder "$output_directory/$(basename "$folder")"; then
# Move the folder to the !empty_folders directory
mv "$output_directory/$(basename "$folder")" "$empty_folders_directory"
echo "Moved $folder to $empty_folders_directory"
fi
fi
done
I've tried the above as well as lots of variants. They either haven't worked at all (i.e. empty\_folders\_directory has nothing it it when it should); or have worked incompletely e.g.: some folders haven't been moved; or contents of folders end up in the root of empty\_folders\_directory (which should never be the case).
Any pointers mucha appreciated.
Thanks
https://redd.it/18v4vbt
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Copy file to a copied structure
I have a pictures folder on my Synology NAS, and within that are a number of albums, each with a set of photos and videos.
I occasionally want to share select photos with family by copying the files, but I want to keep the album structure so it's still viewable i.e. pictures/nans/70thbirthday/, or pictures/parents/10thanniversary/ etc. In reality the files are nested deeper than this, so I don't want to create the folders in target manually. As I don't want to copy the whole folder full of files, I was hoping to copy the file I want to share to a temporary folder, and then a noscript could check the source folders for the original location and replicate that in the family shared folder.
Source would be
I would want to copy file to
Then a bash noscript would find the location of the original file in the /pictures/ folder and recreate the folder structure to
I've been banging my head with find and grep but I don't really know what I'm doing, so haven't even been able to successfully extract the folder from any output.
I had been trying to use
Should I be using
https://redd.it/18uhcf5
@r_bash
I have a pictures folder on my Synology NAS, and within that are a number of albums, each with a set of photos and videos.
I occasionally want to share select photos with family by copying the files, but I want to keep the album structure so it's still viewable i.e. pictures/nans/70thbirthday/, or pictures/parents/10thanniversary/ etc. In reality the files are nested deeper than this, so I don't want to create the folders in target manually. As I don't want to copy the whole folder full of files, I was hoping to copy the file I want to share to a temporary folder, and then a noscript could check the source folders for the original location and replicate that in the family shared folder.
Source would be
/pictures/nans/70thbirthday/img_20220111115326.jpg where there could be 100's of other pictures. I would want to copy file to
/temp/pictures/img_20220111115326.jpgThen a bash noscript would find the location of the original file in the /pictures/ folder and recreate the folder structure to
/shared/events/ i.e. /shared/events/nans/70thbirthday/I've been banging my head with find and grep but I don't really know what I'm doing, so haven't even been able to successfully extract the folder from any output.
I had been trying to use
find '/volume2/pictures/albums/' -type d -name "*img_20220111115326.jpg*" without success.Should I be using
find, or is there a better command to use to set the original folders to a variable?https://redd.it/18uhcf5
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
license-generator: a bash noscript that will generate license for your next open source project
Just wrote this shell noscript which can generate license files. It uses Github's API to fetch license files and make modifications by adding name of project author & year to it. Here's the Github link.
Hadn't written in bash for a long time now, I would love to hear you guys' thoughts on the code. Thanks in advance!
https://redd.it/18ubien
@r_bash
Just wrote this shell noscript which can generate license files. It uses Github's API to fetch license files and make modifications by adding name of project author & year to it. Here's the Github link.
Hadn't written in bash for a long time now, I would love to hear you guys' thoughts on the code. Thanks in advance!
https://redd.it/18ubien
@r_bash
GitHub
GitHub - SamIsTheFBI/license-generator: A POSIX compliant shell noscript that generates license for your open source projects
A POSIX compliant shell noscript that generates license for your open source projects - GitHub - SamIsTheFBI/license-generator: A POSIX compliant shell noscript that generates license for your open sou...
Local -n vs declare -n
Whats the difference between local -n and declare -n when used inside the function?
Bash manual doesnt explain the difference when -n attribute is used for both.
https://redd.it/18to3jj
@r_bash
Whats the difference between local -n and declare -n when used inside the function?
Bash manual doesnt explain the difference when -n attribute is used for both.
https://redd.it/18to3jj
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Generating PNG files with text and "colorful emojis"
I know how to do it with a wide choice of options, but my emojis are all black and white and flat.
I want to get them colorful like on my phone.
I have a trannoscript of a WA chat. I have written code that converts the entire conversation into audio. Now I want to create a video to go with it, containing the actual messages sent back and forth including the emojis, and I really need them to be in color. For reasons!
​
Edit: After searching the depths of the web, I found a tool in imagemagick called Pango that supports this in current versions. I will test it out over the weekend and revert.
https://redd.it/18tku9y
@r_bash
I know how to do it with a wide choice of options, but my emojis are all black and white and flat.
I want to get them colorful like on my phone.
I have a trannoscript of a WA chat. I have written code that converts the entire conversation into audio. Now I want to create a video to go with it, containing the actual messages sent back and forth including the emojis, and I really need them to be in color. For reasons!
​
Edit: After searching the depths of the web, I found a tool in imagemagick called Pango that supports this in current versions. I will test it out over the weekend and revert.
https://redd.it/18tku9y
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
forkrun: the fastest pure-bash loop parallelizer ever written -- looking for "beta testers"
[LINK TO GITHUB REPO WITH CODE](https://github.com/jkool702/forkrun/tree/forkrun-v2_RC)
***
A year ago I started working on `forkrun` - a pure bash (well, almost pure bash) function that works to parallelize loops in much the same way that `xargs -P` and `parallel` do. 1 year, nearly 400 github commits, 1 complete rewrite, and I imagine several hundred hours worth of optimizing later, I do believe that `forkrun` (v2.0) is finally ready to be released.
Before I officially release it, Id love it if a few people would try it out and report any bugs they encounter. Ive thoroughly tested it on my Fedora 39 rig running bash 5.2.x, but other distros and older versions of bash is largely untested (NOTE: min bash version capable of running this is 4.0 due to the use of coprocs) .
Thanks in advance to anyone willing to test it out for me!
***
**USAGE**
There is detailed info in the github readme, but heres some brief usage instructions:
First, source `forkrun.bash` by running one of the following:
. <(curl https://raw.githubusercontent.com/jkool702/forkrun/forkrun-v2_RC/forkrun.bash)
or
wget https://raw.githubusercontent.com/jkool702/forkrun/forkrun-v2_RC/forkrun.bash
. ./forkrun.bash
or
git clone https://github.com/jkool702/forkrun.git --branch=forkrun-v2_RC
. ./forkrun/forkrun.bash
Then use it like you would `xargs`. The base (no flags) `forkrun` is roughly equivalent to `xargs -P $(nproc) -d $'\n'`. After sourcing it, you can display the full usage help (that described the available flags to tweak `forkrun`'s behavior) by running
forkrun --help=all
***
**EXAMPLE**
To compute the `cksum` of every file under the current directory, you would run
find ./ -type f | forkrun cksum
***
P.S. and yes, it really is that fast. My main speed testing has been computing 11 different checksums on ~500,000 mostly small files saved on a tmpfs ramdisk with a total combined size of ~19 gb. The speedtest code + results are [in the github repo](https://github.com/jkool702/forkrun/blob/forkrun-v2_RC/forkrun.speedtest.bash), but to summarize:
* on average it was 70% faster than `xargs -P $(nproc) -d $'\n'`, which is the fastest loop parallelizer I know of (not counting `forkrun`). For the lighter weight checksums like `cksum` and `sum -s` is was closer to 3x faster. Note that this is the fastest implementation of `xargs` (it isnt being crippled by using `-l 1` or `-n 1`), and `xargs` itself is a compiled C binary. Thats right, `forkrun` parallelizes loops faster than the fastest compiled C loop parallelizer I could find.
* on average it is \~7x as fast as `parallel -m`. For the lighter weight checksums like `cksum` and `sum -s` is was >18x faster.
* on my hardware, `forkrun` was computing the lightweight checksums (`cksum` and `sum -s`) on all ~19 gb worth of ~500,000 files in about 1.1 seconds (outputting to `wc -l`), not printing to the terminal)
As such, In can all but guarantee this is the fastest loop parallelizer written in bash that has ever been written. See the github readme if you are curious what makes `forkrun` so fast.
Note: "fast" is referring to "wall clock time". In terms of CPU time `xargs` is a bit better (though not *that* much), but forkrun parallelizes things so well it is faster in "real" execution time.
EDIT: fixed formatting issue.
https://redd.it/18sfjtz
@r_bash
[LINK TO GITHUB REPO WITH CODE](https://github.com/jkool702/forkrun/tree/forkrun-v2_RC)
***
A year ago I started working on `forkrun` - a pure bash (well, almost pure bash) function that works to parallelize loops in much the same way that `xargs -P` and `parallel` do. 1 year, nearly 400 github commits, 1 complete rewrite, and I imagine several hundred hours worth of optimizing later, I do believe that `forkrun` (v2.0) is finally ready to be released.
Before I officially release it, Id love it if a few people would try it out and report any bugs they encounter. Ive thoroughly tested it on my Fedora 39 rig running bash 5.2.x, but other distros and older versions of bash is largely untested (NOTE: min bash version capable of running this is 4.0 due to the use of coprocs) .
Thanks in advance to anyone willing to test it out for me!
***
**USAGE**
There is detailed info in the github readme, but heres some brief usage instructions:
First, source `forkrun.bash` by running one of the following:
. <(curl https://raw.githubusercontent.com/jkool702/forkrun/forkrun-v2_RC/forkrun.bash)
or
wget https://raw.githubusercontent.com/jkool702/forkrun/forkrun-v2_RC/forkrun.bash
. ./forkrun.bash
or
git clone https://github.com/jkool702/forkrun.git --branch=forkrun-v2_RC
. ./forkrun/forkrun.bash
Then use it like you would `xargs`. The base (no flags) `forkrun` is roughly equivalent to `xargs -P $(nproc) -d $'\n'`. After sourcing it, you can display the full usage help (that described the available flags to tweak `forkrun`'s behavior) by running
forkrun --help=all
***
**EXAMPLE**
To compute the `cksum` of every file under the current directory, you would run
find ./ -type f | forkrun cksum
***
P.S. and yes, it really is that fast. My main speed testing has been computing 11 different checksums on ~500,000 mostly small files saved on a tmpfs ramdisk with a total combined size of ~19 gb. The speedtest code + results are [in the github repo](https://github.com/jkool702/forkrun/blob/forkrun-v2_RC/forkrun.speedtest.bash), but to summarize:
* on average it was 70% faster than `xargs -P $(nproc) -d $'\n'`, which is the fastest loop parallelizer I know of (not counting `forkrun`). For the lighter weight checksums like `cksum` and `sum -s` is was closer to 3x faster. Note that this is the fastest implementation of `xargs` (it isnt being crippled by using `-l 1` or `-n 1`), and `xargs` itself is a compiled C binary. Thats right, `forkrun` parallelizes loops faster than the fastest compiled C loop parallelizer I could find.
* on average it is \~7x as fast as `parallel -m`. For the lighter weight checksums like `cksum` and `sum -s` is was >18x faster.
* on my hardware, `forkrun` was computing the lightweight checksums (`cksum` and `sum -s`) on all ~19 gb worth of ~500,000 files in about 1.1 seconds (outputting to `wc -l`), not printing to the terminal)
As such, In can all but guarantee this is the fastest loop parallelizer written in bash that has ever been written. See the github readme if you are curious what makes `forkrun` so fast.
Note: "fast" is referring to "wall clock time". In terms of CPU time `xargs` is a bit better (though not *that* much), but forkrun parallelizes things so well it is faster in "real" execution time.
EDIT: fixed formatting issue.
https://redd.it/18sfjtz
@r_bash
GitHub
GitHub - jkool702/forkrun at forkrun-v2_RC
runs multiple inputs through a noscript/function in parallel using bash coprocs - GitHub - jkool702/forkrun at forkrun-v2_RC
Script to relink broken alias files with new path?
Hi, is there any way to get this done? I have no experience with noscripting, but together with ChatGPT I failed massively to get this done in Terminal on OSX (10.14.6)
From a stupid user perspective:
1. Open Finder-GUI to choose Folder (including subfolder) for damaged/unliked Alias files
2. Check those files for unlinked Aliases.
3. Open Finder-GUI to choose Folder (incl. subfolders) which contains the new destination of the original files.
4. Do the work - restore all Alias links with the new original paths (only for those files, which had a damaged Alias of course).
I cannot find a software that claims to do that on OSX. I am so desperately in need of this function because I work with a software which relies on Aliases for it's internal file management system, and after I did some major reorganisation of my hard drives, I'm left with hundrets of unlinked Aliases..... :(
https://redd.it/18w0sog
@r_bash
Hi, is there any way to get this done? I have no experience with noscripting, but together with ChatGPT I failed massively to get this done in Terminal on OSX (10.14.6)
From a stupid user perspective:
1. Open Finder-GUI to choose Folder (including subfolder) for damaged/unliked Alias files
2. Check those files for unlinked Aliases.
3. Open Finder-GUI to choose Folder (incl. subfolders) which contains the new destination of the original files.
4. Do the work - restore all Alias links with the new original paths (only for those files, which had a damaged Alias of course).
I cannot find a software that claims to do that on OSX. I am so desperately in need of this function because I work with a software which relies on Aliases for it's internal file management system, and after I did some major reorganisation of my hard drives, I'm left with hundrets of unlinked Aliases..... :(
https://redd.it/18w0sog
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Pipe output to a file with auto incremented name?
I like doing
This has progressed to
Is there a utility or noscript that would let me do just
https://redd.it/18w3vt5
@r_bash
I like doing
> temp-file.txt for output of some commands that I might need later.This has progressed to
> ../tmp/2024-01-01-001.txt, but writing the timestamps and index numbers gets tedious.Is there a utility or noscript that would let me do just
> keep or something similar? Seems like a common use case but after a couple of google searches I didn't find anything.https://redd.it/18w3vt5
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Collection Scrips
Hey Guzs , I am collection bash noscripts that shortens the tasks
here is contribution link Bash-Baby
https://redd.it/18wm2p0
@r_bash
Hey Guzs , I am collection bash noscripts that shortens the tasks
here is contribution link Bash-Baby
https://redd.it/18wm2p0
@r_bash
GitHub
GitHub - shreyasSarve/bash-baby: This repository contains bash noscript for time saving
This repository contains bash noscript for time saving - GitHub - shreyasSarve/bash-baby: This repository contains bash noscript for time saving
Trouble formatting output of PS command
I'm trying to get a formatted list of the 5 most CPU intensive processes using the PS command. This works but I'm not sure how to align all values to the left.
I run the command like so:
ps --no-headers -Ao comm:21, -o pid:6, -o pcpu:6 --sort=-pcpu | head -5
which produces the following output:
Isolated Web Co 97231 7.9
firefox 32302 5.5
Isolated Web Co 175732 3.7
Hyprland 689 2.1
RDD Process 45174 1.9
Now I'd like to align the second column to the left but I'm not sure how to do this. Piping it into
Isolated Web Co 97231 8.1
Isolated Web Co 175732 5.7
firefox 32302 5.4
Hyprland 689 2.1
RDD Process 45174 2.0
I'm probably missing something obvious. Can anyone point me in the right direction? It would be much appreciated!
https://redd.it/18xwvec
@r_bash
I'm trying to get a formatted list of the 5 most CPU intensive processes using the PS command. This works but I'm not sure how to align all values to the left.
I run the command like so:
ps --no-headers -Ao comm:21, -o pid:6, -o pcpu:6 --sort=-pcpu | head -5
which produces the following output:
Isolated Web Co 97231 7.9
firefox 32302 5.5
Isolated Web Co 175732 3.7
Hyprland 689 2.1
RDD Process 45174 1.9
Now I'd like to align the second column to the left but I'm not sure how to do this. Piping it into
column -t messes up the layout because of the spaces in the first column's values:Isolated Web Co 97231 8.1
Isolated Web Co 175732 5.7
firefox 32302 5.4
Hyprland 689 2.1
RDD Process 45174 2.0
I'm probably missing something obvious. Can anyone point me in the right direction? It would be much appreciated!
https://redd.it/18xwvec
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Monitor filesystem events using inotify-tools
# inotify-tools
This is a basic guide to use inotify-tools.
```bash
apt-get install inotify-tools
```
## Initial Command
This is basic command of inotify-tools.
* `inotifywait` is a part of inotify-tools.
* `-m` monitor for events continuously (don't exit after the first event).
* `-e create` watch for file creation events specifically.
* `/path/to/directory` The directory to monitor.
```bash
inotifywait -m -e create /path/to/directory
```
When a new file is created, inotifywait will print a line like -
```
CREATE /path/to/directory/new_file.txt
```
Capture this output in a noscript or command to perform actions on the new file.
## Using while loop
```bash
inotifywait -m -e create /path/to/directory | while read line; do
# Extract the filename from the output
filename=$(echo $line | cut -d' ' -f3)
# Do something with the new file
echo "New file created: $filename"
done
```
## Additional options
* `-r` Monitor recursively for changes in subdirectories as well.
* `--format %f` Print only the filename in the output.
* `--timefmt %Y%m%d%H%M%S` Specify a custom timestamp format.
https://redd.it/1ad1pgp
@r_bash
# inotify-tools
This is a basic guide to use inotify-tools.
```bash
apt-get install inotify-tools
```
## Initial Command
This is basic command of inotify-tools.
* `inotifywait` is a part of inotify-tools.
* `-m` monitor for events continuously (don't exit after the first event).
* `-e create` watch for file creation events specifically.
* `/path/to/directory` The directory to monitor.
```bash
inotifywait -m -e create /path/to/directory
```
When a new file is created, inotifywait will print a line like -
```
CREATE /path/to/directory/new_file.txt
```
Capture this output in a noscript or command to perform actions on the new file.
## Using while loop
```bash
inotifywait -m -e create /path/to/directory | while read line; do
# Extract the filename from the output
filename=$(echo $line | cut -d' ' -f3)
# Do something with the new file
echo "New file created: $filename"
done
```
## Additional options
* `-r` Monitor recursively for changes in subdirectories as well.
* `--format %f` Print only the filename in the output.
* `--timefmt %Y%m%d%H%M%S` Specify a custom timestamp format.
https://redd.it/1ad1pgp
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Create bash noscripts 100x faster using libray
# bash-sdk 🔥
A bash library to create standalone noscripts.
https://ourcodebase.gitlab.io/bashsdk-docs/
## Features ✨
There are some features of bash-sdk are mentioned here.
OOPS like code 💎.
Module based code 🗂️.
Similar functions to python 🐍.
Standalone noscript creation 📔.
## Beauty 🏵️
Checkout the ui of this cli project here.
## General 🍷
There are some rules or things to keep in mind while using this library.
The rules are mentioned here.
## Installation 🌀
Just clone it to anywhere.
git clone --depth=1 https://github.com/OurCodeBase/bash-sdk.git
## Modules 📚
These are the modules created in bash-sdk library. You can read about their functions by clicking on them.
[ask.sh](/docs/ask)
cursor.sh
[db](/docs/db)
file.sh
[inspect.sh](/docs/inspect)
os.sh
[package.sh](/docs/package)
repo.sh
[say.sh](/docs/say)
screen.sh
[spinner.sh](/docs/spinner)
string.sh
[url.sh](/docs/url)
## Structure 🗃️
File structure of bash-sdk is like:
bash-sdk
├── docs # docs for bash-sdk.
├── _uri.sh # helper of builder.
├── builder.sh
└── src
├── ask.sh
├── cursor.sh
├── db.sh
├── file.sh
├── inspect.sh
├── os.sh
├── package.sh
├── repo.sh
├── say.sh
├── screen.sh
├── spinner.sh
├── string.sh
└── url.sh
## Compiler 🧭
Compiler does combine all codes in a standalone bash file.
bash builder.sh -i "path/to/input.sh" -o "path/to/output.sh";
input file is the file that you are going to compile.
output file is the standalone result file.
Then you can directly execute output file without bash-sdk library.
## Queries 📢
If you have any questions or doubt related to this library you can directly ask everything [here](https://github.com/OurCodeBase/bash-sdk/issues).
## Suggestion 👌
bash-lsp to your code editor to get auto completions.
[shellcheck](https://github.com/koalaman/shellcheck) to debug bash code.
cooked.nvim code editor to get best compatibility.
## Author 🦋
Created By [@OurCodeBase](https://github.com/OurCodeBase)
Inspired By @mayTermux
https://redd.it/1acumxu
@r_bash
# bash-sdk 🔥
A bash library to create standalone noscripts.
https://ourcodebase.gitlab.io/bashsdk-docs/
## Features ✨
There are some features of bash-sdk are mentioned here.
OOPS like code 💎.
Module based code 🗂️.
Similar functions to python 🐍.
Standalone noscript creation 📔.
## Beauty 🏵️
Checkout the ui of this cli project here.
## General 🍷
There are some rules or things to keep in mind while using this library.
The rules are mentioned here.
## Installation 🌀
Just clone it to anywhere.
git clone --depth=1 https://github.com/OurCodeBase/bash-sdk.git
## Modules 📚
These are the modules created in bash-sdk library. You can read about their functions by clicking on them.
[ask.sh](/docs/ask)
cursor.sh
[db](/docs/db)
file.sh
[inspect.sh](/docs/inspect)
os.sh
[package.sh](/docs/package)
repo.sh
[say.sh](/docs/say)
screen.sh
[spinner.sh](/docs/spinner)
string.sh
[url.sh](/docs/url)
## Structure 🗃️
File structure of bash-sdk is like:
bash-sdk
├── docs # docs for bash-sdk.
├── _uri.sh # helper of builder.
├── builder.sh
└── src
├── ask.sh
├── cursor.sh
├── db.sh
├── file.sh
├── inspect.sh
├── os.sh
├── package.sh
├── repo.sh
├── say.sh
├── screen.sh
├── spinner.sh
├── string.sh
└── url.sh
## Compiler 🧭
Compiler does combine all codes in a standalone bash file.
bash builder.sh -i "path/to/input.sh" -o "path/to/output.sh";
input file is the file that you are going to compile.
output file is the standalone result file.
Then you can directly execute output file without bash-sdk library.
## Queries 📢
If you have any questions or doubt related to this library you can directly ask everything [here](https://github.com/OurCodeBase/bash-sdk/issues).
## Suggestion 👌
bash-lsp to your code editor to get auto completions.
[shellcheck](https://github.com/koalaman/shellcheck) to debug bash code.
cooked.nvim code editor to get best compatibility.
## Author 🦋
Created By [@OurCodeBase](https://github.com/OurCodeBase)
Inspired By @mayTermux
https://redd.it/1acumxu
@r_bash
ourcodebase.gitlab.io
bash-sdk 🔥 | OurCodeBase
A docs for bash-sdk
BEE-GENTLE-1ST-BASH-SCRIPT
so, I am looking to make my life a bit simple, I use nmap and use some pentesting labs. IP of target always changes and instead of remembering the ip of the target, it would be nice to just use TARGET in my commands that I pass.
I sudo this file and it was giving me ability to append a new targetname and ip to /etc/hosts file
e.g. target1 10.10.10.101
I tried it and it worked, so I added in a command where I need some guidance, pointers on how I can add the delete option. I googled and saw sed command but not sure how to incorporate it.
My expectation is to cat the /etc/hosts file and see whats there, then add or delete as needed before a new pentest box is being worked on.
filename: addtarget.sh
#!/bin/sh
echo "What is the TARGET # please"
read TARGET
echo "Enter IP address please"
read IP
/new line added to delete/ echo "Enter TARGET # to delete from /etc/hosts"
/new line added to delete/ read DEL
/new line added to delete/ sed -i.bak '/target$DEL\'./d' /etc/hosts # will delete lines containing "target."
echo "Adding $TARGET and its associated $IP address for you"
echo "$TARGET $IP" >> /etc/hosts
++++++++++++++++++++++
Thank you in advance to this community and any support you can provide me.
https://redd.it/1acytdx
@r_bash
so, I am looking to make my life a bit simple, I use nmap and use some pentesting labs. IP of target always changes and instead of remembering the ip of the target, it would be nice to just use TARGET in my commands that I pass.
I sudo this file and it was giving me ability to append a new targetname and ip to /etc/hosts file
e.g. target1 10.10.10.101
I tried it and it worked, so I added in a command where I need some guidance, pointers on how I can add the delete option. I googled and saw sed command but not sure how to incorporate it.
My expectation is to cat the /etc/hosts file and see whats there, then add or delete as needed before a new pentest box is being worked on.
filename: addtarget.sh
#!/bin/sh
echo "What is the TARGET # please"
read TARGET
echo "Enter IP address please"
read IP
/new line added to delete/ echo "Enter TARGET # to delete from /etc/hosts"
/new line added to delete/ read DEL
/new line added to delete/ sed -i.bak '/target$DEL\'./d' /etc/hosts # will delete lines containing "target."
echo "Adding $TARGET and its associated $IP address for you"
echo "$TARGET $IP" >> /etc/hosts
++++++++++++++++++++++
Thank you in advance to this community and any support you can provide me.
https://redd.it/1acytdx
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Utility that Scans A Bash Script And Lists All Required Commands
#### I'm looking for a utility that scans a bash noscript and lists all required commands. Some reqs and specs, v00.03.
Do you know of such a beast?
I have not been able to frame a valid web query, other than ones that generate terabytes of cruft.
Barring that, I could use some help with specs.
**Shortcuts?**
* I can safely ignore or disallow command names and functions with embedded spaces.
* Would running the bash '-x' option provide a better basis for the scan, or is the source better?
* Or, what?
* I have a few noscripts that write other noscripts (templates, with an intervening editing session). I suppose that if I have a utility that can scan a "non-recursive" noscript, I could use the utility recursively?
**"Specs"**
* I only want the list to include external commands; if Bash internals are included, I would prefer that they be listed separately.
* There are quite a few Bash internals that have external equivalents, e.g., 'echo' and 'test'. I need to be able to distinguish between the two like-named commands. Is a format like '/bin/test', for example, sufficient to distinguish between the two?
* Ignore first <words> followed by '()'
* Ignore everything to the right of a '#' not quoted or escaped.
This gets pretty complicated on multiline quotes with embedded quotes, i.e.:
- \>"...'...'..."<
- \>"...'...'..."<
- \>"...\"...<
- etc.
* First <word> on a line.
* First <word> following a ';'.
* First <word> following a '|'.
* First <word> following a '$(', or '`'.
https://redd.it/1acparm
@r_bash
#### I'm looking for a utility that scans a bash noscript and lists all required commands. Some reqs and specs, v00.03.
Do you know of such a beast?
I have not been able to frame a valid web query, other than ones that generate terabytes of cruft.
Barring that, I could use some help with specs.
**Shortcuts?**
* I can safely ignore or disallow command names and functions with embedded spaces.
* Would running the bash '-x' option provide a better basis for the scan, or is the source better?
* Or, what?
* I have a few noscripts that write other noscripts (templates, with an intervening editing session). I suppose that if I have a utility that can scan a "non-recursive" noscript, I could use the utility recursively?
**"Specs"**
* I only want the list to include external commands; if Bash internals are included, I would prefer that they be listed separately.
* There are quite a few Bash internals that have external equivalents, e.g., 'echo' and 'test'. I need to be able to distinguish between the two like-named commands. Is a format like '/bin/test', for example, sufficient to distinguish between the two?
* Ignore first <words> followed by '()'
* Ignore everything to the right of a '#' not quoted or escaped.
This gets pretty complicated on multiline quotes with embedded quotes, i.e.:
- \>"...'...'..."<
- \>"...'...'..."<
- \>"...\"...<
- etc.
* First <word> on a line.
* First <word> following a ';'.
* First <word> following a '|'.
* First <word> following a '$(', or '`'.
https://redd.it/1acparm
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
bash noscript developer
Hi I am a researcher and I have to write some bash noscripts for my project but I am too new here. Could you please help me (as a consultant or paid bash noscript writer)?
https://redd.it/1acdtxz
@r_bash
Hi I am a researcher and I have to write some bash noscripts for my project but I am too new here. Could you please help me (as a consultant or paid bash noscript writer)?
https://redd.it/1acdtxz
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Iterating over ls output is fragile. Use globs.
My editor gave me this warning, can y'all help me understand why?
The warnig again is:
`Iterating over ls output is fragile. Use globs.`
Here is my lil noscript:
#!/usr/bin/env bash
for ZIPFILE in $(ls *.zip)
do
echo "Unzipping $ZIPFILE..."
unzip -o "$ZIPFILE"
done
What should I use instead of `$(ls *.zip)` and why?
https://redd.it/1abus2n
@r_bash
My editor gave me this warning, can y'all help me understand why?
The warnig again is:
`Iterating over ls output is fragile. Use globs.`
Here is my lil noscript:
#!/usr/bin/env bash
for ZIPFILE in $(ls *.zip)
do
echo "Unzipping $ZIPFILE..."
unzip -o "$ZIPFILE"
done
What should I use instead of `$(ls *.zip)` and why?
https://redd.it/1abus2n
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community