#!/bin/bash for file in /usr/local/hellohost/bin/*; do echo "$file" >> ~/hellohost_cli_help.txt [ -f "$file" ] && [ -x "$file" ] && "$file" >> ~/hellohost_cli_help.txt done sed -i 's\/usr/local/hellohost/bin/\\' ~/hellohost_cli_help.txt