Mostrando entradas con la etiqueta scripting. Mostrar todas las entradas
Mostrando entradas con la etiqueta scripting. Mostrar todas las entradas

domingo, 1 de febrero de 2009

Cómo repetir una cadena en bash

Dos maneras de repetir una cadena en bash, un número determinado de veces. En este caso desde 1 hasta 3:

nouser@nohost:~$ CADENA="loquesea_"

nouser@nohost:~$ for i in {1..3};do printf "%s" $CADENA;done;echo
loquesea_loquesea_loquesea_
nouser@nohost:~$ printf "$CADENA%.0s" {1..3};echo
loquesea_loquesea_loquesea_


jueves, 6 de septiembre de 2007

Getting Oracle 10 datapump full path

This week I have been working on a bash script and I had the need to know the full path of my Oracle 10 datapump directory (directories).

I have found some useful links with general info about datapumps, how to create them, etc, but none of them told me how to find out their defined paths...

Navigating the dictionary information through the PL/SQL Developer trees I have found the view SYS.ALL_DIRECTORIES which contains what I wanted. I have just take a look to this view definition and... this is how I finally get my datapump dirs:

...

export IFS="

"

export DATAPUMP_DIRS=`

echo "

set heading off;

set feedback off;

select d.os_path

from sys.obj$ o, sys.dir$ d

where o.obj# = d.obj#

and o.type# = 23;

" | sqlplus -S $USER/$PASSWORD

`

...