#!/bin/bash # Generate the list of packages without version numbers and concatenate them into a single line packages=$(pipx list --short | awk '{print $1}' | tr '\n' ' ') # Start the heredoc to write to the file cat << EOF > 020_pipx-packages.sh #!/bin/bash # This file is generated by the update-pipx-packages.sh do not edit directly. # This script installs pipx packages # Install packages pipx install $packages EOF # Make the script executable chmod +x 020_pipx-packages.sh