code
stringlengths
1
1.96M
language
stringclasses
1 value
# $OpenBSD: multiplex.sh,v 1.12 2009/05/05 07:51:36 dtucker Exp $ # Placed in the Public Domain. CTL=/tmp/openssh.regress.ctl-sock.$$ tid="connection multiplexing" if config_defined DISABLE_FD_PASSING ; then echo "skipped (not supported on this platform)" exit 0 fi DATA=/bin/ls${EXEEXT} COPY=$OBJ/ls....
Shell
# $OpenBSD: reexec.sh,v 1.5 2004/10/08 02:01:50 djm Exp $ # Placed in the Public Domain. tid="reexec tests" DATA=/bin/ls${EXEEXT} COPY=${OBJ}/copy SSHD_ORIG=$SSHD${EXEEXT} SSHD_COPY=$OBJ/sshd${EXEEXT} # Start a sshd and then delete it start_sshd_copy () { cp $SSHD_ORIG $SSHD_COPY SSHD=$SSHD_COPY st...
Shell
# $OpenBSD: agent.sh,v 1.7 2007/11/25 15:35:09 jmc Exp $ # Placed in the Public Domain. tid="simple agent test" SSH_AUTH_SOCK=/nonexistent ${SSHADD} -l > /dev/null 2>&1 if [ $? -ne 2 ]; then fail "ssh-add -l did not fail with exit code 2" fi trace "start agent" eval `${SSHAGENT} -s` > /dev/null r=$? if...
Shell
# $OpenBSD: ssh-com-keygen.sh,v 1.4 2004/02/24 17:06:52 markus Exp $ # Placed in the Public Domain. tid="ssh.com key import" #TEST_COMBASE=/path/to/ssh/com/binaries if [ "X${TEST_COMBASE}" = "X" ]; then fatal '$TEST_COMBASE is not set' fi VERSIONS=" 2.0.10 2.0.12 2.0.13 2.1.0 2.2.0 2.3.0 2.3...
Shell
# $OpenBSD: putty-kex.sh,v 1.2 2008/06/30 10:31:11 djm Exp $ # Placed in the Public Domain. tid="putty KEX" DATA=/bin/ls COPY=${OBJ}/copy if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then echo "putty interop tests not enabled" exit 0 fi for k in dh-gex-sha1 dh-group1-sha1 dh-group14-sha1 ; do verb...
Shell
# $OpenBSD: brokenkeys.sh,v 1.1 2004/10/29 23:59:22 djm Exp $ # Placed in the Public Domain. tid="broken keys" KEYS="$OBJ/authorized_keys_${USER}" start_sshd mv ${KEYS} ${KEYS}.bak # Truncated key echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEABTM= bad key" > $KEYS cat ${KEYS}.bak >> ${KEYS} cat $OBJ/$t.p...
Shell
# $OpenBSD: connect.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="simple connect" start_sshd for p in 1 2; do ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true if [ $? -ne 0 ]; then fail "ssh connect with protocol $p failed" fi done
Shell
# $OpenBSD: sftp-badcmds.sh,v 1.4 2009/08/13 01:11:55 djm Exp $ # Placed in the Public Domain. tid="sftp invalid commands" DATA=/bin/ls${EXEEXT} DATA2=/bin/sh${EXEEXT} NONEXIST=/NONEXIST.$$ COPY=${OBJ}/copy GLOBFILES=`(cd /bin;echo l*)` rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd rm -f ${COPY} verbo...
Shell
# $OpenBSD: putty-transfer.sh,v 1.2 2008/06/30 10:31:11 djm Exp $ # Placed in the Public Domain. tid="putty transfer data" DATA=/bin/ls COPY=${OBJ}/copy if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then echo "putty interop tests not enabled" exit 0 fi # XXX support protocol 1 too for p in 2; do f...
Shell
# $OpenBSD: reconfigure.sh,v 1.2 2003/06/21 09:14:05 markus Exp $ # Placed in the Public Domain. tid="simple connect after reconfigure" # we need the full path to sshd for -HUP case $SSHD in /*) # full path is OK ;; *) # otherwise make fully qualified SSHD=$OBJ/$SSHD esac start_sshd PID=`$SUDO...
Shell
# $OpenBSD: connect-privsep.sh,v 1.1 2002/03/21 21:45:07 markus Exp $ # Placed in the Public Domain. tid="proxy connect with privsep" echo 'UsePrivilegeSeparation yes' >> $OBJ/sshd_proxy for p in 1 2; do ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true if [ $? -ne 0 ]; then fail "ssh privsep+proxyconn...
Shell
# $OpenBSD: localcommand.sh,v 1.1 2007/10/29 06:57:13 dtucker Exp $ # Placed in the Public Domain. tid="localcommand" echo 'PermitLocalCommand yes' >> $OBJ/ssh_proxy echo 'LocalCommand echo foo' >> $OBJ/ssh_proxy for p in 1 2; do verbose "test $tid: proto $p localcommand" a=`${SSH} -F $OBJ/ssh_proxy -$p ...
Shell
# $OpenBSD: test-exec.sh,v 1.37 2010/02/24 06:21:56 djm Exp $ # Placed in the Public Domain. #SUDO=sudo # Unbreak GNU head(1) _POSIX2_VERSION=199209 export _POSIX2_VERSION case `uname -s 2>/dev/null` in OSF1*) BIN_SH=xpg4 export BIN_SH ;; esac if [ ! -z "$TEST_SSH_PORT" ]; then PORT="$TEST_SSH_...
Shell
# $OpenBSD: envpass.sh,v 1.4 2005/03/04 08:48:46 djm Exp $ # Placed in the Public Domain. tid="environment passing" # NB accepted env vars are in test-exec.sh (_XXX_TEST_* and _XXX_TEST) # Prepare a custom config to test for a configuration parsing bug fixed in 4.0 cat << EOF > $OBJ/ssh_proxy_envpass Host t...
Shell
#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.2 2003/11/21 12:48:55 djm Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` ...
Shell
#!/bin/sh # # Fake Root Solaris/SVR4/SVR5 Build System - Prototype # # The following code has been provide under Public Domain License. I really # don't care what you use it for. Just as long as you don't complain to me # nor my employer if you break it. - Ben Lindstrom (mouring@eviladmin.org) # umask 022 # ...
Shell
#!/bin/sh # # fixpaths - substitute makefile variables into text files # Usage: fixpaths -Dsomething=somethingelse ... die() { echo $* exit -1 } test -n "`echo $1|grep -- -D`" || \ die $0: nothing to do - no substitutions listed! test -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || \ die $0: error in ...
Shell
#! /bin/bash i=1; while [ $i -le 50 ] do echo $1 echo $i i=$[ $i + 1 ]; done
Shell
#! /bin/bash i=1; while [ $i -le 50 ] do echo $1 echo $i i=$[ $i + 1 ]; done
Shell
#! /bin/sh # Simple program to make new version numbers for the shell. # Big deal, but it was getting out of hand to do everything # in the makefile. This creates a file named by the -o option, # otherwise everything is echoed to the standard output. # Copyright (C) 1996-2002 Free Software Foundation, Inc. #...
Shell
#! /bin/sh # # shobj-conf -- output a series of variable assignments to be substituted # into a Makefile by configure which specify system-dependent # information for creating shared objects that may be loaded # into bash with `enable -f' # # usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vend...
Shell
#! /bin/bash # # mkclone - symlink every file appearing in $src/MANIFEST to a corresponding # file in the target directory ($1). Directories specified in # MANIFEST are created in the target directory # # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you ca...
Shell
#! /bin/sh - # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any...
Shell
#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2003 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This pro...
Shell
#! /bin/sh # # fixlinks - make symlinks in the bash source tree so that there is # exactly one version of any given source file. # # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pu...
Shell
#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation...
Shell
#! /bin/sh # # shobj-conf -- output a series of variable assignments to be substituted # into a Makefile by configure which specify system-dependent # information for creating shared objects that may be loaded # into bash with `enable -f' # # usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vend...
Shell
#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case $1 in ...
Shell
#! /bin/sh # texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources. # $Id: texi2dvi,v 1.14 2003/02/05 00:42:33 karl Exp $ # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, # 2002, 2003 Free Software Foundation, Inc. # # This program is free software: you can redistribute...
Shell
#! /bin/sh # # fixlinks - make symlinks in the bash source tree so that there is # exactly one version of any given source file. # # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pu...
Shell
#! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2003 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This pro...
Shell
#! /bin/bash # # mkclone - symlink every file appearing in $src/MANIFEST to a corresponding # file in the target directory ($1). Directories specified in # MANIFEST are created in the target directory # # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you ca...
Shell
#! /bin/sh # Simple program to make new version numbers for the shell. # Big deal, but it was getting out of hand to do everything # in the makefile. This creates a file named by the -o option, # otherwise everything is echoed to the standard output. # Copyright (C) 1996-2002 Free Software Foundation, Inc. #...
Shell
#!/bin/sh - # # bashbug - create a bug report and mail it to the bug address # # The bug address depends on the release status of the shell. Versions # with status `devel', `alpha', `beta', or `rc' mail bug reports to # chet@cwru.edu and, optionally, to bash-testers@cwru.edu. # Other versions send mail to bug-b...
Shell
#! /bin/sh # # rlvers.sh -- run a program that prints out the readline version number # using locally-installed readline libraries # # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Gene...
Shell
#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation...
Shell
#! /bin/sh # # mkconffiles - create _distribution and _patchlevel files in preparation # for recreating `configure' from `configure.in' # # options: # -s srcdir directory where `configure' resides (defaults to `.') # -d outdir directory where the files should be written (defaults # to "$srcdir") # -v verbo...
Shell
#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License...
Shell
#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20098 # Free Software Foundation, Inc. timestamp='2008-03-26' # This file is (in principle) common to ALL GNU software. # The ...
Shell
#! /bin/sh # # mkdirs - a work-alike for `mkdir -p' # # Chet Ramey # chet@po.cwru.edu # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Soft...
Shell
#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. timestamp='2008-03-12' # This file is free software; you can redistribute it and/or modify ...
Shell
#! /bin/sh - # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any...
Shell
#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License...
Shell
#! /bin/sh # # mkconffiles - create _distribution and _patchlevel files in preparation # for recreating `configure' from `configure.in' # # options: # -s srcdir directory where `configure' resides (defaults to `.') # -d outdir directory where the files should be written (defaults # to "$srcdir") # -v verbo...
Shell
#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case $1 in ...
Shell
#!/bin/sh - # # bashbug - create a bug report and mail it to the bug address # # The bug address depends on the release status of the shell. Versions # with status `devel', `alpha', `beta', or `rc' mail bug reports to # chet@cwru.edu and, optionally, to bash-testers@cwru.edu. # Other versions send mail to bug-b...
Shell
#! /bin/sh # # rlvers.sh -- run a program that prints out the readline version number # using locally-installed readline libraries # # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Gene...
Shell
#! /bin/sh # # mkdirs - a work-alike for `mkdir -p' # # Chet Ramey # chet@po.cwru.edu # Copyright (C) 1996-2002 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Soft...
Shell
: # link bash for Xenix under SCO Unix # # For xenix 2.2: # CC="cc -xenix -lx" ./configure # edit config.h: # comment out the define for HAVE_DIRENT_H # enable the define for HAVE_SYS_NDIR_H to 1 # make # CC="cc -xenix -lx" ./link.sh # # For xenix 2.3: # CC="cc -x2.3" ./configure # make # CC="cc -x2.3" ...
Shell
#! /bin/sh # texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources. # $Id: texi2dvi,v 1.14 2003/02/05 00:42:33 karl Exp $ # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, # 2002, 2003 Free Software Foundation, Inc. # # This program is free software: you can redistribute...
Shell
#!../bash # # Test correct trap return codes = 2 means skip execution. shopt -s extdebug print_trap() { echo "lineno: $1 ($LINENO) ${FUNCNAME[1]}" if [[ $debug_exit == 2 ]] ; then debug_exit=0 return 2 fi return 0 } debug_exit=0 trap 'print_trap $LINENO' DEBUG x=1 echo "x is $x"...
Shell
#! /bin/sh # # run-minimal - a version of run-all for shells configured with # --enable-minimal-config # PATH=.:$PATH # just to get the right version of printenv export PATH # unset BASH_ENV only if it is set [ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV # ditto for SHELLOPTS #[ "${SHELLOPTS+set}" = "set...
Shell
#!../bash #$Id: run-dbg-support2,v 1.3 2002/11/14 06:08:16 rockyb Exp $ TEST_NAME='dbg-support2' TEST_FILE="/tmp/${TEST_NAME}.check" ${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null set -f diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE # Return code tells testing mechanism whether passed...
Shell
echo before trap trap 'echo caught sigint' 2 echo after trap for i in 1 2 3 do echo $i sleep 5 done
Shell
../../bash ./redir-t2.sh < /etc/passwd
Shell
read line1 echo read line 1 \"$line1\" exec 4<&0 exec 0</dev/tty read line2 echo line read from tty = \"$line2\" exec 0<&4 read line3 echo read line 3 \"$line3\"
Shell
#! /bin/bash i=0 while [ $i -lt $1 ] do /bin/sh -c "sleep 4; exit 0" & rv=$? pid=$! eval bg_pid_$i=$pid echo $$: Job $i: pid is $pid rv=$rv i=$((i + 1)) done i=0 while [ $i -lt $1 ] do eval wpid=\$bg_pid_$i echo Waiting for job $i '('pid $wpid')' wait $wpid ...
Shell
#!/bin/bash typeset -i m2 m1 M n2 n1 N m n typeset -i MM=5 NN=5 case $# in 0) : ;; 1) MM=$1; NN=$1 ;; 2) MM=$1; NN=$2 ;; *) echo 1>&2 "Usage: $0 [m [n]]" ;; esac EMPTYLINE=: # echo echo 'a = { ' # mathematica let "M=1" # for (M=1; M<=MM; M++) while let "M <=...
Shell
sleep 5 & sleep 5 & sleep 5 & echo wait 1 wait echo wait 2 wait exit
Shell
#! /bin/bash i=0 while [ $i -lt $1 ] do /bin/sh -c "sleep 4; exit 0" & rv=$? pid=$! eval bg_pid_$i=$pid echo $$: Job $i: pid is $pid rv=$rv i=$((i + 1)) done i=0 while [ $i -lt $1 ] do eval wpid=\$bg_pid_$i echo Waiting for job $i '('pid $wpid')' wait $wpid ...
Shell
#!/bin/bash typeset -i m2 m1 M n2 n1 N m n typeset -i MM=5 NN=5 case $# in 0) : ;; 1) MM=$1; NN=$1 ;; 2) MM=$1; NN=$2 ;; *) echo 1>&2 "Usage: $0 [m [n]]" ;; esac EMPTYLINE=: # echo echo 'a = { ' # mathematica let "M=1" # for (M=1; M<=MM; M++) while let "M <=...
Shell
trap 'echo sigint' 2 sleep 5 & sleep 5 & sleep 5 & echo wait 1 wait echo wait 2 wait exit
Shell
echo before loop for i in 1 2 3 do echo $i sleep 5 done
Shell
# # varenv.sh # # Test the behavior of the shell with respect to variable and environment # assignments # expect() { echo expect "$@" } a=1 b=2 c=3 d=4 e=5 f=6 g=7 h=8 a=3 b=4 $CHMOD $MODE $FN # This should echo "3 4" according to Posix.2 expect "3 4" echo $a $b set -k # Assignment state...
Shell
#! /bin/bash NJOB=8 i=0 while [ $i -lt $NJOB ] do /bin/sh -c "sleep 4; exit 0" & rv=$? pid=$! eval bg_pid_$i=$pid # echo $$: Job $i: pid is $pid rv=$rv i=$((i + 1)) done i=0 while [ $i -lt $NJOB ] do eval wpid=\$bg_pid_$i echo Waiting for job $i #'('pid $wpid')' ...
Shell
#!../bash #$Id: run-set-x,v 1.1 2002/12/09 13:12:37 rockyb Exp $ TEST_NAME='set-x' TEST_FILE="/tmp/${TEST_NAME}.check" ${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null set -f diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE # Return code tells testing mechanism whether passed or not. exit...
Shell
#!/local/bin/bash #Time-stamp: <95/06/07 07:40:40 hrue@imf.unit.no> getop () { local OPTIND local OPTERR=1 echo getop: OPTERR=$OPTERR while getopts ab arg "$@"; do case $arg in a) echo a here ;; b) echo b here ;; :|?|*) echo something else here ;; ...
Shell
#!../bash #$Id: run-dbg-support,v 1.5 2002/11/14 06:08:16 rockyb Exp $ TEST_NAME='dbg-support' TEST_FILE="/tmp/${TEST_NAME}.check" ${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null set -f diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE # Return code tells testing mechanism whether passed o...
Shell
#!/bin/bash arrayA=("A" "B" "C") arrayB=( ${arrayA[*]} ) echo "Case01---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" arrayB=( "${arrayA[*]}" ) echo "Case02---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" arrayB=( ${arrayA[@]} ) echo "Case03---${#arrayB[@]}---${arrayB[0]}:${...
Shell
#!../bash #$Id: run-dbg-support2,v 1.3 2002/11/14 06:08:16 rockyb Exp $ TEST_NAME='dbg-support2' TEST_FILE="/tmp/${TEST_NAME}.check" ${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null set -f diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE # Return code tells testing mechanism whether passed...
Shell
#! /bin/sh # # run-minimal - a version of run-all for shells configured with # --enable-minimal-config # PATH=.:$PATH # just to get the right version of printenv export PATH # unset BASH_ENV only if it is set [ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV # ditto for SHELLOPTS #[ "${SHELLOPTS+set}" = "set...
Shell
#! /bin/sh # posix-2.sh - Simple identification tests for POSIX.2 features # commonly missing or incorrectly implemented. # Time-stamp: <96/04/10 16:43:48 gildea> # By Stephen Gildea <gildea@x.org> March 1995 # # Copyright (c) 1995 Stephen Gildea # Permission is hereby granted to deal in this Software without r...
Shell
#! /bin/sh PATH=.:$PATH # just to get recho/zecho/printenv if not run via `make tests' export PATH # unset BASH_ENV only if it is set [ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV # ditto for SHELLOPTS #[ "${SHELLOPTS+set}" = "set" ] && unset SHELLOPTS : ${THIS_SH:=../bash} export THIS_SH ${THIS_SH} ...
Shell
#!../bash # # Test correct functioning bash debug support not via the bashdb # debugger but merely by printing via print_trap() # $Id: dbg-support.tests,v 1.13 2003/02/17 22:02:25 rockyb Exp $ shopt -s extdebug print_debug_trap() { echo "debug lineno: $1 ${FUNCNAME[1]}" return } print_return_trap() { ...
Shell
#! /bin/bash NJOB=8 i=0 while [ $i -lt $NJOB ] do /bin/sh -c "sleep 4; exit 0" & rv=$? pid=$! eval bg_pid_$i=$pid # echo $$: Job $i: pid is $pid rv=$rv i=$((i + 1)) done i=0 while [ $i -lt $NJOB ] do eval wpid=\$bg_pid_$i echo Waiting for job $i #'('pid $wpid')' ...
Shell
#!../bash # $Id: set-x.tests,v 1.1 2002/12/09 13:12:37 rockyb Exp $ # # Test that "set -x" shows what we think it should. # set -x for ((i=0; i<=5; i++ )) ; do x=0 done for i in 0 1 2 ; do x=i done case x in 0) x=i ;; *) x=i ;; esac set +x # test BASH_XTRACEFD ${THIS_SH} ./set-x1.sub
Shell
#!../bash #$Id: run-set-x,v 1.1 2002/12/09 13:12:37 rockyb Exp $ TEST_NAME='set-x' TEST_FILE="/tmp/${TEST_NAME}.check" ${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null set -f diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE # Return code tells testing mechanism whether passed or not. exit...
Shell
#!../bash # # Test correct trap return codes = 2 means skip execution. shopt -s extdebug print_trap() { echo "lineno: $1 ($LINENO) ${FUNCNAME[1]}" if [[ $debug_exit == 2 ]] ; then debug_exit=0 return 2 fi return 0 } debug_exit=0 trap 'print_trap $LINENO' DEBUG x=1 echo "x is $x"...
Shell
#!/bin/bash arrayA=("A" "B" "C") arrayB=( ${arrayA[*]} ) echo "Case01---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" arrayB=( "${arrayA[*]}" ) echo "Case02---${#arrayB[*]}---${arrayB[0]}:${arrayB[1]}:${arrayB[2]}---" arrayB=( ${arrayA[@]} ) echo "Case03---${#arrayB[@]}---${arrayB[0]}:${...
Shell
#!/local/bin/bash #Time-stamp: <95/06/07 07:40:40 hrue@imf.unit.no> getop () { local OPTIND local OPTERR=1 echo getop: OPTERR=$OPTERR while getopts ab arg "$@"; do case $arg in a) echo a here ;; b) echo b here ;; :|?|*) echo something else here ;; ...
Shell
#!../bash # # Test correct functioning bash debug support not via the bashdb # debugger but merely by printing via print_trap() # $Id: dbg-support.tests,v 1.13 2003/02/17 22:02:25 rockyb Exp $ shopt -s extdebug print_debug_trap() { echo "debug lineno: $1 ${FUNCNAME[1]}" return } print_return_trap() { ...
Shell
#!../bash # $Id: set-x.tests,v 1.1 2002/12/09 13:12:37 rockyb Exp $ # # Test that "set -x" shows what we think it should. # set -x for ((i=0; i<=5; i++ )) ; do x=0 done for i in 0 1 2 ; do x=i done case x in 0) x=i ;; *) x=i ;; esac set +x # test BASH_XTRACEFD ${THIS_SH} ./set-x1.sub
Shell
echo before calling input-line.sub ${THIS_SH} ./input-line.sub this line for input-line.sub echo finished with input-line.sub
Shell
#! /bin/sh PATH=.:$PATH # just to get recho/zecho/printenv if not run via `make tests' export PATH # unset BASH_ENV only if it is set [ "${BASH_ENV+set}" = "set" ] && unset BASH_ENV # ditto for SHELLOPTS #[ "${SHELLOPTS+set}" = "set" ] && unset SHELLOPTS : ${THIS_SH:=../bash} export THIS_SH ${THIS_SH} ...
Shell
#!../bash #$Id: run-dbg-support,v 1.5 2002/11/14 06:08:16 rockyb Exp $ TEST_NAME='dbg-support' TEST_FILE="/tmp/${TEST_NAME}.check" ${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null set -f diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE # Return code tells testing mechanism whether passed o...
Shell
#! /bin/sh # posix-2.sh - Simple identification tests for POSIX.2 features # commonly missing or incorrectly implemented. # Time-stamp: <96/04/10 16:43:48 gildea> # By Stephen Gildea <gildea@x.org> March 1995 # # Copyright (c) 1995 Stephen Gildea # Permission is hereby granted to deal in this Software without r...
Shell
#! /bin/sh # # psize.sh -- determine this system's pipe size, and write a define to # pipesize.h so ulimit.c can use it. : ${TMPDIR:=/tmp} # try to use mktemp(1) if the system supports it { TMPFILE="`mktemp $TMPDIR/pipsize.XXXXXX 2>/dev/null`"; } 2>/dev/null used_mktemp=true if [ -z "$TMPFILE" ]...
Shell
#! /bin/sh # # psize.sh -- determine this system's pipe size, and write a define to # pipesize.h so ulimit.c can use it. : ${TMPDIR:=/tmp} # try to use mktemp(1) if the system supports it { TMPFILE="`mktemp $TMPDIR/pipsize.XXXXXX 2>/dev/null`"; } 2>/dev/null used_mktemp=true if [ -z "$TMPFILE" ]...
Shell
#! /bin/sh # # Some of these should really be done by man2html # # The ~/xxx links don't really work -- netscape doesn't expand the home # directory of the user running navigator # sed -e 's|<B>gnu.bash.bug</B>|<A HREF="news:gnu.bash.bug">gnu.bash.bug</A>|g' \ -e 's|<I>/bin/bash</I>|<A HREF="file:/bin/bas...
Shell
#! /bin/sh # # Some of these should really be done by options to makeinfo or by # using @setfilename, but this way we can have both bashref.info and # bash.info (for installing) # sed -e 's|bashref.info|bash.info|g'
Shell
#! /bin/sh # # Some of these should really be done by man2html # # The ~/xxx links don't really work -- netscape doesn't expand the home # directory of the user running navigator # sed -e 's|<B>gnu.bash.bug</B>|<A HREF="news:gnu.bash.bug">gnu.bash.bug</A>|g' \ -e 's|<I>/bin/bash</I>|<A HREF="file:/bin/bas...
Shell
#! /bin/sh # # Some of these should really be done by options to makeinfo or by # using @setfilename, but this way we can have both bashref.info and # bash.info (for installing) # sed -e 's|bashref.info|bash.info|g'
Shell
case $- in *i*) ;; *) return ;; esac # bogus if [ -f /unix ] ; then alias ls='/bin/ls -CF' else alias ls='/bin/ls -F' fi alias ll='ls -l' alias dir='ls -ba' alias ss="ps -aux" alias dot='ls .[a-zA-Z0-9_]*' alias news="xterm -g 80x45 -e trn -e -S1 -N &" alias c="clear" alias m="more" alias j="j...
Shell
## # Set path ## export PATH="${HOME}/${MACHTYPE}/bin:${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" export MANPATH="${HOME}/man:/usr/local/share/man:/usr/share/man" ## # Read user's login ## if (-r ${bash_initdir}/login.mine) then source ${bash_initdir}/login.mine fi
Shell
# stty.bash # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1992-01-11 # Last modified: 1993-09-29 # Public domain # Conversion to bash v2 syntax done by Chet Ramey # Commentary: # Code: require remap_keybindings #:docstring stty: # Track changes to certain keybindings with stty, and mak...
Shell
# y_or_n_p.bash # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1992-06-18 # Last modified: 1993-03-01 # Public domain # Conversion to bash v2 syntax done by Chet Ramey # Commentary: # Code: #:docstring y_or_n_p: # Usage: y_or_n_p QUERY # # Print QUERY on stderr, then read stdin for a y-o...
Shell
# bash_version.bash --- get major and minor components of bash version number # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1993-01-26 # Last modified: 1993-01-26 # Public domain # Converted to bash v2 syntax by Chet Ramey # Commentary: # Code: #:docstring bash_version: # Usage: bash_vers...
Shell
# mktmp.bash # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1993-02-03 # Last modified: 1993-02-03 # Public domain # Conversion to bash v2 syntax done by Chet Ramey # Commentary: # Code: #:docstring mktmp: # Usage: mktmp [template] {createp} # # Generate a unique filename from TEMPLATE b...
Shell
# number.bash # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1993-02-22 # Last modified: 1993-04-01 # Public domain # Conversion to bash v2 syntax done by Chet Ramey # Commentary: # Code: #:docstring number: # Usage: number [number] # # Converts decimal integers to english notation. Spa...
Shell
# meta.bash --- meta key frobnications # Author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1992-06-28 # Last modified: 1993-01-26 # Public domain # Commentary: # Code: #:docstring meta: # Usage: meta [on|off] # # An argument of "on" will make bash use the 8th bit of any input from # a terminal...
Shell