find "$directory" -type f -name "*.in"
is a bit shorter than that whole thing (and safer – deals with whitespace in filenames and directory names).
Your script is probably failing for entries that don’t have a .
in their name, making $extension
empty.
More Related Contents:
- Looping through the content of a file in Bash
- Why should eval be avoided in Bash, and what should I use instead?
- How to redirect output to a file and stdout
- How to kill a child process after a given timeout in Bash?
- ./configure : /bin/sh^M : bad interpreter [duplicate]
- The ‘eval’ command in Bash and its typical uses
- How to join multiple lines of file names into one with custom delimiter?
- Linux: copy and create destination dir if it does not exist
- How to redirect the output of the time command to a file in Linux?
- Bash function to find newest file matching pattern
- How to handle more than 10 parameters in shell
- How to count lines in a document? [closed]
- Linux bash: Multiple variable assignment
- How do I syntax check a Bash script without running it?
- Is it OK to use the same input file as output of a piped command?
- Pass a password to ssh in pure bash
- Run cron job only if it isn’t already running
- Redirecting command output in docker
- When to wrap quotes around a shell variable?
- How to get file creation date/time in Bash/Debian?
- Disable and re-enable address space layout randomization only for myself
- How to join multiple lines of filenames into one with custom delimiter
- Check if a variable exists in a list in Bash
- Doesn’t sh support process substitution
- Counter increment in Bash loop not working
- Start script after another one (already running) finishes
- Add a newline only if it doesn’t exist
- Problem with Bash output redirection [duplicate]
- bash: set array env variable and de-referencing it from any shell script fails
- Why exit code 141 with grep -q?