source: wspkg/freebsd/freebsd.deps.sh @ f6d5ca1

Last change on this file since f6d5ca1 was f6d5ca1, checked in by Ting-Wei Lan <lantw44@…>, 3 years ago

Use 'printf' to print non-constant strings in shell scripts

It is unsafe to use 'echo' with strings with variable substitutions.
Different 'echo' implementations may accept different options, and they
can interpret strings with escape characters in different ways. The
behavior of 'printf' is much more consistent so it should be preferred.

  • Property mode set to 100755
File size: 293 bytes
Line 
1#!/bin/sh
2
3ports_file="$1"
4: ${ports_file:="freebsd.ports"}
5
6exec 4< "${ports_file}"
7
8while read -r pkg_name pkg_ports pkg_flavor 0<&4; do
9        if [ "${pkg_flavor}" != "@" ]; then
10                pkg_ports="${pkg_ports}@${pkg_flavor}"
11        fi
12        printf '    %s>=a:%s ^%%' "${pkg_name}" "${pkg_ports}"
13done
14
15exec 4<&-
Note: See TracBrowser for help on using the repository browser.