Bruk rlwrap!

Et av mine favorittprogram er rlwrap. Det programmet «pakker» jeg inn i andre programmer hvor jeg ønsker at pil-tastene skal anvendes for enkel redigering av teksten.

Hvis du arbeider på Ubuntu Linux finnes pakken ferdig kompilert, da er det bare å laste ned programmet:

 
oracle@ubuntu: ~ $ sudo apt-get install rlwrap
...


For de fleste andre Linux og Unix varianter må du først søke på Google etter rlwrap og laste ned kildekoden. For Red Hat Linux, Oracle Linux og Centos kan du hente ned ekstra pakker ved å legge inn en definisjon hvor de finnes. Her er 64-bits versjonen lastet ned for versjon 6 av Red Hat Linux, Oracle Linux og Centos.

 
[root@oel6 yum.repos.d]# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Henter http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
advarsel: /var/tmp/rpm-tmp.XaeXJm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Forbereder...               ########################################### [100%]
   1:epel-release           ########################################### [100%]

[root@oel6 yum.repos.d]# yum install rlwrap
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rlwrap.x86_64 0:0.37-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                          Arch                             Version                              Repository                      Size
=============================================================================================================================================
Installing:
 rlwrap                           x86_64                           0.37-1.el6                           epel                            90 k

Transaction Summary
=============================================================================================================================================
Install       1 Package(s)

Total download size: 90 k
Installed size: 196 k
Is this ok [y/N]: y
Downloading Packages:
rlwrap-0.37-1.el6.x86_64.rpm                                                                                          |  90 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : rlwrap-0.37-1.el6.x86_64                                                                                                  1/1 
  Verifying  : rlwrap-0.37-1.el6.x86_64                                                                                                  1/1 

Installed:
  rlwrap.x86_64 0:0.37-1.el6                                                                                                                 

Complete!

Hvis ikke det hjelper, må du kompilere koden på egen hånd.

 
[oracle@linux tmp]$ tar xvzf rlwrap-0.30.tar.gz
rlwrap-0.30/
rlwrap-0.30/completions/
rlwrap-0.30/completions/ftp
...

[oracle@linux tmp]$ cd rlwrap-0.30
/tmp/rlwrap-0.30

[oracle@linux rlwrap-0.30]$ ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk

...

config.status: creating distribution/rlwrap.spec
config.status: creating config.h
config.status: executing depfiles commands

Now do:
make (or gmake)  to build rlwrap
make check       for instructions how to test it
make install     to install it

[oracle@linux rlwrap-0.30]$ make
make  all-recursive
make[1]: Entering directory `/tmp/rlwrap-0.30'
Making all in doc
/tmp/rlwrap-0.30/doc
make[2]: Entering directory `/tmp/rlwrap-0.30/doc'
sed -e 's#@DATADIR@#/usr/local/share#'  rlwrap.man > rlwrap.1
make[2]: Leaving directory `/tmp/rlwrap-0.30/doc'
Making all in src

[oracle@linux rlwrap-0.30]$ sudo make install
Password: ######
Making install in doc
/tmp/rlwrap-0.30/doc
make[1]: Entering directory `/tmp/rlwrap-0.30/doc'
make[2]: Entering directory `/tmp/rlwrap-0.30/doc'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/man/man1" || /bin/mkdir -p "/usr/local/share/man/man1"
/usr/bin/install -c -m 644 './rlwrap.1' '/usr/local/share/man/man1/rlwrap.1'
make[2]: Leaving directory `/tmp/rlwrap-0.30/doc'
make[1]: Leaving directory `/tmp/rlwrap-0.30/doc'
Making install in src
/tmp/rlwrap-0.30/src
make[1]: Entering directory `/tmp/rlwrap-0.30/src'
make[2]: Entering directory `/tmp/rlwrap-0.30/src'
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
/usr/bin/install -c 'rlwrap' '/usr/local/bin/rlwrap'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/rlwrap-0.30/src'
make[1]: Leaving directory `/tmp/rlwrap-0.30/src'
make[1]: Entering directory `/tmp/rlwrap-0.30'
make[2]: Entering directory `/tmp/rlwrap-0.30'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/rlwrap" || /bin/mkdir -p "/usr/local/share/rlwrap"
/usr/bin/install -c -m 644 'completions/ftp' '/usr/local/share/rlwrap/ftp'
/usr/bin/install -c -m 644 'completions/testclient' '/usr/local/share/rlwrap/testclient'
/usr/bin/install -c -m 644 'completions/coqtop' '/usr/local/share/rlwrap/coqtop'
make[2]: Leaving directory `/tmp/rlwrap-0.30'
make[1]: Leaving directory `/tmp/rlwrap-0.30'

[oracle@linux rlwrap-0.30]$ which rlwrap
/usr/local/bin/rlwrap

Muligens må du laste ned fler biblioteker for å få rlwrap til å kompilere.

 
[oracle@linux tmp]$ tar xvzf readline-5.2.tar.gz
readline-5.2/
readline-5.2/doc/
readline-5.2/doc/Makefile.in

...

[oracle@linux readline-5.2]$ cd readline-5.2
/tmp/readline-5.2

[oracle@linux readline-5.2]$  ./configure
[oracle@linux readline-5.2]$ make
[oracle@linux readline-5.2]$ sudo make install
[oracle@linux readline-5.2]$ sudo ldconfig

Legg inn noen alias i for eksempel .bashrc så er rlwrap inkludert i de programmene du bruker hver dag.

 
ingemar@linux: ~ $ cd

ingemar@linux: ~ $ vi .bashrc

alias sql='sqlplus "/ as sysdba"'
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias dgmgrl='rlwrap dgmgrl'

alias boston='. ~/.boston'
alias chicago='. ~/.chicago'
alias emrep='. ~/.emrep'

alias test10g='. ~/.test10g'
alias test11g='. ~/.test11g'

alias ll='ls -ltr'

Da er det bare å teste hvordan dine program fungerer.

Lykke til!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*