In case you …



This page lists miscellaneous infos about miscellaneous stuff, such as some bizarre issues i encountered or small tips for which i did not want to write posts… Hope this will help someone.





… you are experiencing some bizarre errors when using array(s)

such as :

declare: not found
./ValidInstall.bash: 226: Syntax error: "(" unexpected


Check your shebang, for bash it should looks like:


and not:


even if the symbolic link exists:

/bin/sh -> /bin/bash

and especially for ubuntu boxes when the dash is used:

/bin/sh -> dash*


… you always forget where the files are

  • File associations definitions:
    • System wide




… you wonder how to install kate editor on CentOS 6

  1. Installing Kate on CentOS 6
    • Kate is a part of KDE dev kit, so installing the kdesdk would be enough to get kate editor:
      yum install kdesdk


… you wonder how to install vlc on CentOS 6

  1. Installing vlc on CentOS 6
    • vlc is available from the RPMForge repo, but this repo is not “compatible” with others like EPEl: so keep in mind to disable this repo, and unless you need to, enable it before performing your tasks:
      yum --enablerepo=rpmforge install vlc


… you wonder how to use an X server after using “su -” command

If for whatever reasons you lost access to an X server after changing user via a su - <new_user> command (This will more likely occurs on a remote computer access via ssh), here is a dirty hack also known as workaround:

  1. You should first make sure you used the -X option for your ssh connection (X forwarding)
  2. Then if you lost your X connection after the su -and get the following error :
    X11 connection rejected because of wrong authentication.
  3. Fix it by :
    1. exiting your “newly connected to” user account¬† (exit or [Ctrl+d])
    2. finding your X authentication token :
      XToken=$(xauth list | grep -m1 $(echo ${DISPLAY} | cut -d":" -f 2 | cut -d"." -f 1))
    3. re- launching your su -command:
      su -c "xauth add ${XToken}" <new_user>

Note : you should be done now, by the way a cleaner tips will come soon for this same issue….

Edit : I guess i finally found a cleaner tip for this, here it is.

You can use the xhost command. This xhost command is used to control access to X server, you can for example allow everyone to access you Xserver without any authentication, or you can also allow only one chosen user.

  1. Allow every user to access your X server :
    xhost +
  2. Allow only a given user (user1 in this example) :
    xhost +SI:localuser:user1



… you need to install an X window system and a graphic environment on CentOS / RHel / Fedora

In case you installed a server without X windows nor graphic environment (such as the basic server setup on OS installation), and you finally need one !

  • Launch the following command and you should be OK!
    yum groupinstall "X Window System" "KDE Desktop"

    for Gnome replace KDE Desktop by GNOME Desktop Environment or any other desktop manager …

  • To use your newly installed Desktop manager
  • On next reboot you will be prompt for several configuration including :
    1. Authentication
    2. Keyboard
    3. Firewall
    4. Network
    5. startup services
  • if you happen to be still in text mode after reboot, you need to change the inidefault parameter in /etc/inittabfile from :



You should, now, be starting a graphic session on next reboot.


… you encounter problems when using indentation inside a HEREDOC

You may find out that inside a bash HEREDOC (as well as in many other languages) you cannot indent anything (by default). To change this behaviour you need to specify a special operator as : <<-

  • Your HEREDOC may now look like this :
SendMail() {
  nc -v mailhost 25 1>/dev/null <<- EOF
        ehlo ${HOSTNAME}
        mail from: ${HOSTNAME}
        rcpt to: $ADMIN
        rcpt to: $ADMIN2
        rcpt to: $ADMIN3
        From: ${HOSTNAME}
        To: $ADMIN
        To: $ADMIN2
        To: $ADMIN3
        Subject: [MONITORING] Critical size on ${HOSTNAME}


… you wonder how to update a SYMLINK target

Just use the combination of the -s and -f options
Note : Those option s may not be available on you *nux flavor

ln -s -f ../path/to/new/target /path/to/symlink

[user@test ~/test]$ ls .
[user@test ~/test]$
[user@test ~/test]$ ln -s /data/pbellicini/ocs_mass-import.log ./symlink
[user@test ~/test]$ ll ./symlink
lrwxrwxrwx 1 pbellicini TREFLE 36 jun  6 09:44 ./symlink -> /data/pbellicini/ocs_mass-import.log
[user@test ~/test]$ ln -s -f /data/pbellicini/signature  ./symlink
[user@test ~/test]$ ll ./symlink
lrwxrwxrwx 1 pbellicini TREFLE 26 jun  6 09:45 ./symlink -> /data/pbellicini/signature


… you wonder why you cannot run a script or any executable file from a mounted dvd/cd

This might be because of the mount option, or more specifically the lack of a certain option : -o exec.

Try to re-mount your dvd/cd using this option and you should be done.

mount -o exec /dev/cdrom /media

Leave a Reply

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

This site supports SyntaxHighlighter via WP SyntaxHighlighter. It can highlight your code.
How to highlight your code: Paste your code in the comment form, select it and then click the language link button below. This will wrap your code in a <pre> tag and format it when submitted.