Project

General

Profile

  • svn:executable: *

# Date Author Comment
12201 02/14/2014 10:04 AM Aaron Marcuse-Kubitza

*{.sh,run}: stderr_matches calls: don't need to wrap the command in `"try"` because stderr_matches now does this

12200 02/14/2014 09:55 AM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: `shopt -s lastpipe`: suppress error message if not supported

12199 02/14/2014 09:50 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: ignore_err_msg(): use new stderr_matches alias, which includes prep_try (requires loading new aliases)

12198 02/14/2014 09:49 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: stderr_matches(): need to save PIPESTATUS and then use the saved var because it's reset after each cmd

12197 02/14/2014 09:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr_matches(): place exit status of cmd in $e for use with exception handling

12196 02/14/2014 09:21 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set `shopt -s lastpipe`, to allow setting vars in the last command of a pipeline

12195 02/14/2014 08:43 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: ignore_err_msg(): use `try` properly with prep_try and `"try"`

12194 02/14/2014 08:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added prep_try and use it in try alias. try: documented how to run it with a wrapper command.

12192 02/14/2014 08:20 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added ignore_err_msg()

12190 02/14/2014 07:31 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr_matches(): usage: surrounded command in if statement to indicate what context it would usually be used in

11970 01/20/2014 11:33 AM Aaron Marcuse-Kubitza

moved everything into /trunk/ to create the standard svn layout, for use with tools that require this (eg. git-svn). IMPORTANT: do NOT do an `svn up`. instead, re-use your working copy's existing files with `svn switch` (http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.switch.html).

11914 12/16/2013 04:58 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: verbosity_min(): usage: clarified that '' is a special value that causes $verbosity to be overwritten to ''

11858 12/06/2013 05:37 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr2stdout(): documented that this redirects fd 2->1 and log_fd (but not back to 2)

11857 12/06/2013 05:34 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: stderr2stdout() use `command` before tee, which re-filters log_fd so that stderr itself is also filtered. this allows log-filtering out an otherwise-confusing benign error when using e.g. stderr_matches().

11856 12/06/2013 04:31 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added not(), for use in prefixing wrapped commands

11854 12/06/2013 04:10 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added stderr_matches()

11853 12/06/2013 03:59 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: documented that fds 2x/3x should not be used because we use these, as opposed to 1x which is used by the shell internally

11852 12/06/2013 03:57 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added stdout_contains()

11851 12/06/2013 03:34 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added stderr2stdout()

11784 11/26/2013 10:58 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: import_vars: don't overwrite vars that are already defined, to allow the caller to specify their own values for the vars to create. this requires callers that rely on the overwriting functionality to reverse the order in which they run use_* commands, so that the higher-precedence use_* is applied first and the other one as the default values for the first.

11605 11/09/2013 02:02 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: already_exists_msg(): added instructions on how to force-remake when the file already exists (prepend `rm=1` to the command)

11432 10/24/2013 04:24 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added require_dot_script()

11431 10/24/2013 04:13 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: $top_script: use @BASH_SOURCE instead of $0, because this is also defined for .-scripts

11426 10/24/2013 03:17 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: is_dot_script(): need to subtract 1 from ${#BASH_LINENO[@]}, because this is the array length rather than the index of the last element as in Perl

11425 10/24/2013 02:58 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added is_dot_script()

11413 10/23/2013 09:11 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: alias_append(): need to enclose $(alias) call in "" because its result may contain separator chars (i.e. whitespace) that will be parsed incorrectly. this appears to only be a bug when runscripts are run as shell-includes, with a leading ".".

11250 10/12/2013 12:08 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added instructions for making an export only visible locally

10921 09/12/2013 12:35 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): don't add surrounding quotes to empty redirect dest

10920 09/12/2013 12:31 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): need to check if redirect is empty before escaping it with `printf %q`, which may add surrounding quotes to an empty string

10890 09/07/2013 08:14 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): need to escape redirect destinations which are files, because they may contain special shell characters

10889 09/07/2013 08:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added rm_prefix()

10822 08/30/2013 02:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: is_array(): handle unset vars (=false). this fixes a bug in pg_export_table_no_header, which produced the error "lib/sh/util.sh: line 290: declare: cols: not found".

10821 08/30/2013 02:06 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: join(): documented that delim must be a single char

10773 08/27/2013 08:59 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): remove empty redirects resulting from using `redirs= cmd...` to clear the redirs and then using $redirs as an array

10772 08/27/2013 08:47 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: set_fds(): documented that it does not currently support redirecting an fd to itself (due to bash bugs that require the dest fd to be closed before it can be reopened)

10771 08/27/2013 08:44 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: stdout2fd(): don't add >&$fd redirect if the fd is 1, because redir does not currently support redirecting an fd to itself (due to bash bugs that require the dest fd to be closed before it can be reopened)

10770 08/27/2013 08:40 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: filter_fd(): factored out >() subshell command into stdout2fd() for clarity

10769 08/27/2013 08:33 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: redir(): unset redirs so that you don't redirect again in the invoked command

10768 08/27/2013 08:29 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: filter_fd(): documented that ${redirs[@]} must not be set to an outer value

10648 08/08/2013 07:15 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: pf(): echo func decl to stderr instead of stdout

10647 08/08/2013 07:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_vars(): documented that it only prints vars that are defined

10646 08/08/2013 07:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: local_inv: also echo_vars the new var

10506 07/30/2013 10:07 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: $sed_cmd: added usage

10440 07/26/2013 05:16 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: $sed_cmd: make output unbuffered, so that running e.g. bin/my2pg at the command line produces output as each line is read

10400 07/24/2013 05:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added is_array()

10271 07/14/2013 01:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved runscript-related commands to lib/runscripts/util.run because these only apply to runscripts

10217 07/10/2013 03:41 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: sed: must use alias instead of function because function causes segfault in redir() subshell when used with make.sh make() filter (may be bug in bash?). this involves translating `unset LANG` to `env LANG=` (`env -u` to unset a var isn't supported on Mac, but fortunately sed treats LANG="" the same as unset LANG).

10214 07/10/2013 02:42 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: sed: unset LANG to avoid "illegal byte sequence" errors on invalid UTF-8 for LANG=*.UTF-8. these occur e.g. with MySQL data that is in Latin-1.

10213 07/10/2013 02:36 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: sed: use function instead of alias so that env can be set up before calling sed

10154 07/03/2013 05:15 PM Aaron Marcuse-Kubitza

*{.sh,run}: use new log-() instead of log+() with a negative #

10153 07/03/2013 05:14 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added log-() because it's non-obvious that you would otherwise have to invoke log+() with a negative #

10143 07/02/2013 05:40 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added canon_dir_rel_path(), which canonicalizes just the parent dir if the path is a symlink, to leave the symlink itself untouched

10064 06/26/2013 02:19 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added self_name alias and use it in self/self_sys

10063 06/26/2013 02:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added sys_cmd_path() and use it in cmd2sys

10059 06/26/2013 12:19 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: .rel(): first use realpath() on BASH_SOURCE1 in case it's a symlink (as it is for bin/make)

10046 06/26/2013 12:23 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: self_sys alias: use new sys_cmd() instead of `command -p` so that only the command path resolution is performed with a limited PATH, and the invoked command itself inherits the full PATH

10045 06/26/2013 12:22 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added sys_cmd(), which runs a system command and allows running a system command of the same name as the script

10044 06/26/2013 12:20 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo_builtin()

10022 06/25/2013 12:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): added nonrecursive=1 flag, which uses cmd2abs_path to run an external command nonrecursively

10021 06/25/2013 12:16 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added cmd2abs_path, which makes the command in $1 nonrecursive

10020 06/25/2013 11:37 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: PATH_rm(): also need to remove adjacent occurrences of the same path (or occurrences which become adjacent when other paths are removed), which :...: matching wasn't doing because the trailing : is consumed, preventing it from being matched at the beginning of the next path. since unlike filesystem paths with /, it is not necessary for a match to span multiple :-separated sections, we can just use new split() to split apart the PATH into an array of paths, filter each path, and join() them back together.

10019 06/25/2013 11:33 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added split()

10018 06/25/2013 10:32 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: auto-echo common external commands: added `which`

10017 06/25/2013 10:32 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: auto-echo common external commands: use simpler echo_run instead of command since logging handling is not needed

9945 06/19/2013 08:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added in_top_dir()

9939 06/19/2013 06:37 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added wildcard1 alias

9938 06/19/2013 06:37 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo1()

9900 06/17/2013 07:59 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command-specific alternate stdin/stdout/stderr: choice of 40/41/42: added mnemonic that 4 looks like A for Alternate

9878 06/12/2013 10:28 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: verbosity_compat(): always use default verbosity (`unset verbosity`) when verbosity == 1, regardless of whether the caller has set $verbosity to the special value "", because $verbosity is supposed to be an integer field and "" is not supported by most functions that use $verbosity. in cases where a util.sh script is invoked, it will set $verbosity back to the default value 1, so this will function as before for util.sh scripts and fix $verbosity for scripts that use a different verbosity system.

9872 06/12/2013 08:16 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_func(): check can_log at beginning of function, so that the resource-intensive func_loc (which calls `readlink -f`) does not need to be called if echo_cmd would not log anything at the current verbosity

9871 06/12/2013 08:02 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_func(): removed no longer used $minor flag. use `clog++... echo_func` instead.

9870 06/12/2013 07:25 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: verbosity_compat(): don't make $verbosity a local var of this function, because then the changes will not be visible to the caller

9868 06/12/2013 07:10 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): command__exec(): use verbosity_compat to support commands that don't support verbosity=""

9867 06/12/2013 07:09 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added verbosity_compat(), for use with commands that don't support verbosity=""

9865 06/12/2013 06:46 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: self, self_sys aliases: need to remove any func_override suffix __* from the FUNCNAME

9853 06/12/2013 03:24 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added .rel()

9850 06/12/2013 02:11 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: .(): put echo_func on its own line for clarity

9849 06/12/2013 02:10 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: .(): added echo_func (2 log_levels up because it's internal)

9846 06/11/2013 07:43 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: verbosity_min(): support value '', which sets verbosity=''

9844 06/11/2013 06:38 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: run_args_cmd(): time the command so that the runtime of the outer runscript target (i.e. the command run from the shell) is printed at the end of the output, like in bin/make

9831 06/11/2013 04:15 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added mv2dir(), mv_glob which wrap mv

9830 06/11/2013 04:14 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added mkdir alias which adds -p to prevent errors if the dir already exists

9829 06/11/2013 03:45 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added wildcard alias, similar to make's $(wildcard) function

9810 06/09/2013 08:27 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added path_parents()

9809 06/09/2013 08:01 PM Aaron Marcuse-Kubitza

*{.sh,run}: in comments, use ${array[@]} instead of @array for clarity

9808 06/09/2013 07:54 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: foreach_arg(): moved `local a` to same line as for loop that uses it

9806 06/09/2013 06:53 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: foreach_arg(): echo_run the cmd at a log_level up so it isn't printed as if it were an external command (log_level 1)

9804 06/09/2013 06:32 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): localize $i so it doesn't overwrite any previous value

9799 06/09/2013 06:25 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added foreach_arg()

9798 06/09/2013 06:06 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: need to use `declare -p` instead of ${var+isset} because ${var+isset} returns not set for empty arrays

9797 06/09/2013 06:05 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo_vars() stub

9796 06/09/2013 05:43 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo_run() stub

9795 06/09/2013 05:39 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: set_fds(): don't run (or echo) exec if no redirections are being made

9794 06/09/2013 05:37 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: added missing stub for indent alias (used by echo_func alias, which is a stub). without the stub, /usr/bin/indent would be used instead on Mac.

9791 06/09/2013 03:56 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: support custom $base_dir, which will be run through realpath() to match $path ($PWD, which was used before, did not need to be realpath'd because it was already absolute)

9790 06/09/2013 03:34 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved echo_func alias to stub because it must be embedded in its expanded alias form to work properly

9789 06/09/2013 03:29 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: declare echo_func as a stub before it's defined, so that functions can use it even if they are defined before it (and its logging functionality will be enabled as soon as it's defined)

9788 06/09/2013 03:26 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: rel_path(): don't log++ it, and instead only log++ applicable calls of it or its callers. this allows non-internal calls of rel_path() to be logged at the usual log_level.

9751 06/06/2013 06:35 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: log+ aliases: added clog++/-- aliases for cmds, which don't include log_local. these are useful when you can't just use "log++" because you need the command following it to be alias-expanded.

9747 06/06/2013 05:26 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added bg_cmd() and helpers log_bg(), log_last_bg()