# Post History

An easy one-liner in POSIX-compatible shells: for f in *-min.jpg-*; do mv -- "$f" "${f%-*}"; done The only (mildly) tricky concept here is ${f%-*}, which expands to $f minus the shortest suffix...

Answer

##
**#4: Post edited**

- An easy one-liner in POSIX-compatible shells:
- ```
~~for f in *-min.jpg-*; do mv "$f" "${f%-*}"; done~~- ```
- The only (mildly) tricky concept here is `${f%-*}`, which expands to `$f` minus the shortest suffix matching the glob pattern `-*`.

- An easy one-liner in POSIX-compatible shells:
- ```
- for f in *-min.jpg-*; do mv
**--**"$f" "${f%-*}"; done - ```
- The only (mildly) tricky concept here is `${f%-*}`, which expands to `$f` minus the shortest suffix matching the glob pattern `-*`.

##
**#3: Post edited**

~~An easy one-liner in~~**Bash and Bash**-compatible shells:- ```
- for f in *-min.jpg-*; do mv "$f" "${f%-*}"; done
- ```
~~The only (mildly) tricky concept here is `${f%-*}`, which~~**is a Bashism representing**`$f` minus the shortest suffix matching the glob pattern `-*`.

- An easy one-liner in
**POSIX**-compatible shells: - ```
- for f in *-min.jpg-*; do mv "$f" "${f%-*}"; done
- ```
- The only (mildly) tricky concept here is `${f%-*}`, which
**expands to**`$f` minus the shortest suffix matching the glob pattern `-*`.

##
**#2: Post edited**

- An easy one-liner in Bash and Bash-compatible shells:
- ```
- for f in *-min.jpg-*; do mv "$f" "${f%-*}"; done
- ```
~~The only (mildly) tricky concept here is `${f%-*}`, which is a Bashism representing `$f` minus the shortest suffix matching the pattern `-*`.~~

- An easy one-liner in Bash and Bash-compatible shells:
- ```
- for f in *-min.jpg-*; do mv "$f" "${f%-*}"; done
- ```
- The only (mildly) tricky concept here is `${f%-*}`, which is a Bashism representing `$f` minus the shortest suffix matching the
**glob**pattern `-*`.