Hot answers tagged

7

Ctrl+R works with ksh in emacs mode (ksh -o emacs or set -o emacs within ksh), and it was most probably the first shell to support it. Only it's not as interactive as in zsh or bash or tcsh's i-search-back widget. In ksh (both ksh88 and ksh93), you type Ctrl+RtextReturn. And Ctrl+RReturn to search again with the same text. In vi mode, you can use ? to ...


4

The Korn shell does support history searches using CtrlR, at least since ksh93 (and perhaps even ksh88), but they don't work quite like bash. First you need to enable Emacs mode: set -o emacs (This enables other niceties, such as arrow keys working by default.) Now if you press CtrlR, the shell will print ^R; type your search, hit Enter, and the shell ...


3

My advice is keep things simple. Don't write a whole script when there is a ready-made tool that already does what you want. du is the tool for reporting on disk usage, and find is the tool for finding files. Use them together. find dirname* -mindepth 1 -maxdepth 1 -type d -exec du -hs {} \; -maxdepth and -mindepth are GNU extensions; to handle this ...


2

Try something like this: SLAPD='/usr/bin/slapd' SERVICE='ldap://localhost:10389 ldaps://solsrv02.internal.vbox:10689 ldaps://solsrv02.prod.internal.vbox:10689' SLAPDARGS="-u '${LDAPUSR}'" SLAPDARGS+=" -g '${LDAPGRP}'" SLAPDARGS+=" -h '${SERVICE}'" SLAPDARGS+=" -F '${CONFDIR}'" $SLAPD $SLAPDARGS Just so you can see what that does (when run after ...


1

works fine when executed in terminal. but when i add to my existing shell script which is running as a concurrent program, the program errors out throwing the error "Bad substitution". Syntax errors in a script? That usually indicates that you aren't using the same shell for the script and interactively. #Parameters : Takes the following input ...


1

As stated by steeldriver, if you use GNU sed, you can tell which occurrence should be replaced, e.g.: echo "/test/test/ 12 /test/test" | sed -n -e 's_/._/_2 p' If you can not make use of this feature you can also write: echo "/test/test/ 12 /test/test" | sed -n -r -e 's_(/[a-z]([a-z]+))\1_\1/\2_ p' Biliography: http://www.grymoire.com/Unix/Sed.html ...



Only top voted, non community-wiki answers of a minimum length are eligible