[SOLVED] bash and xterm - which files get read and referenced?

I currently have my user shell set as /bin/sh (which, as I'm sure you are aware, is a symlink to bash). When I launch xterm, none of my config files seem to be read or sourced. If I login from the console, all is correct.
According to the documentation I've read, when bash is invoked as sh, it should read /etc/profile, and then .profile, and finally .shrc (which is recommended to be explicitly sourced from .profile). I can see that /etc/profile is being read, as the PATH is being updated from items in /etc/profile.d, but none of my config files in ~ are being read.
I put in a unique alias in each of .bash_profile, .bashrc, .profile, and .shrc to try to trace the files being read. In console, this reveals that .profile and .shrc are being read (as I would expect). But, in xterm, no aliases are being read.
Also, PS1 is set to sh-4.2$ (literally set as '\s-\v\$ '). I have tried to grep that sequence in /etc, but that failed to hit on anything.
I don't have my own .Xresources and nothing in .xinitrc redefines xterm behavior. The only switches I am explicitly sending to xterm redefine appearance (background/foreground color and font).
The only other relevant piece of information I can think of is that I am using the slim login manager and in slim.conf it defines: login_cmd exec /bin/bash -login ~/.xinitrc %session. I changed that to /bin/sh, but it had no effect.
Any ideas?
Solution
Adding
XTerm*.LoginShell: True
to ~/.Xdefaults will cause xterm to behave as expected.
Last edited by archnet (2011-05-11 00:40:49)

dmz wrote:
To answer your actual question:
strace -eopen xterm
strace -eopen sh
Here is the output:
sh-4.2$ strace -eopen xterm
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/usr/lib/libXft.so.2", O_RDONLY) = 3
open("/usr/lib/libXaw.so.7", O_RDONLY) = 3
open("/lib/libncursesw.so.5", O_RDONLY) = 3
open("/lib/libc.so.6", O_RDONLY) = 3
open("/usr/lib/libfontconfig.so.1", O_RDONLY) = 3
open("/usr/lib/libX11.so.6", O_RDONLY) = 3
open("/usr/lib/libXmu.so.6", O_RDONLY) = 3
open("/usr/lib/libXt.so.6", O_RDONLY) = 3
open("/usr/lib/libICE.so.6", O_RDONLY) = 3
open("/usr/lib/libfreetype.so.6", O_RDONLY) = 3
open("/usr/lib/libXrender.so.1", O_RDONLY) = 3
open("/usr/lib/libXext.so.6", O_RDONLY) = 3
open("/usr/lib/libXpm.so.4", O_RDONLY) = 3
open("/usr/lib/libz.so.1", O_RDONLY) = 3
open("/usr/lib/libexpat.so.1", O_RDONLY) = 3
open("/usr/lib/libxcb.so.1", O_RDONLY) = 3
open("/lib/libdl.so.2", O_RDONLY) = 3
open("/usr/lib/libSM.so.6", O_RDONLY) = 3
open("/usr/lib/libXau.so.6", O_RDONLY) = 3
open("/usr/lib/libXdmcp.so.6", O_RDONLY) = 3
open("/lib/libuuid.so.1", O_RDONLY) = 3
open("/proc/meminfo", O_RDONLY) = 3
open("/home/archnet/.Xauthority", O_RDONLY) = 4
open("/home/archnet/.Xdefaults", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/locale-archive", O_RDONLY) = 4
open("/usr/share/X11/locale/locale.alias", O_RDONLY) = 4
open("/usr/share/X11/locale/locale.alias", O_RDONLY) = 4
open("/usr/share/X11/locale/locale.dir", O_RDONLY) = 4
open("/usr/share/X11/locale/en_US.UTF-8/XLC_LOCALE", O_RDONLY) = 4
open("/home/archnet/.Xdefaults-natoufa", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.Xdefaults", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/X11/app-defaults/XTerm", O_RDONLY) = 4
open("/etc/ld.so.cache", O_RDONLY) = 4
open("/usr/lib/libXcursor.so.1", O_RDONLY) = 4
open("/usr/lib/libXfixes.so.3", O_RDONLY) = 4
open("/home/archnet/.icons/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/xterm", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/sb_v_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/cursors/sb_h_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/cursors/sb_h_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/sb_h_double_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/cursors/sb_up_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/cursors/sb_up_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/sb_up_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/cursors/sb_down_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/cursors/sb_down_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/sb_down_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/cursors/sb_left_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/cursors/sb_left_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/sb_left_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/cursors/sb_right_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/archnet/.icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/cursors/sb_right_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/icons/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/cursors/sb_right_arrow", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/pixmaps/default/index.theme", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/tty", O_RDWR) = 4
open("/dev/ptmx", O_RDWR) = 4
open("/home/archnet/.XCompose", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/X11/locale/compose.dir", O_RDONLY) = 5
open("/usr/share/X11/locale/en_US.UTF-8/Compose", O_RDONLY) = 5
open("/usr/share/X11/XKeysymDB", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/gconv/gconv-modules", O_RDONLY) = 5
open("/usr/share/terminfo/x/xterm", O_RDONLY) = 5
sh-4.2$ strace -eopen sh
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libreadline.so.6", O_RDONLY) = 3
open("/lib/libncursesw.so.5", O_RDONLY) = 3
open("/lib/libdl.so.2", O_RDONLY) = 3
open("/lib/libc.so.6", O_RDONLY) = 3
open("/dev/tty", O_RDWR|O_NONBLOCK) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
open("/proc/meminfo", O_RDONLY) = 3
open("/etc/nsswitch.conf", O_RDONLY) = 3
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libnss_files.so.2", O_RDONLY) = 3
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/gconv/gconv-modules", O_RDONLY) = 3
open("/home/archnet/.bash_history", O_RDONLY) = 3
open("/home/archnet/.bash_history", O_RDONLY) = 3
open("/usr/share/terminfo/x/xterm", O_RDONLY) = 3
open("/etc/inputrc", O_RDONLY) = 3
I don't see it attempting to read any sort of profile for shrc file.

Similar Messages

  • Which file gets created automatically while migrating

    Which file gets created automatically while migrating from non-ASM files to ASM diskgroup by using RMAN?----No.113
    A. the contol file
    B. the alert log file
    C. the parameter file
    D. the server parameter file
    E. the archive redo log file
    Message was edited by:
    frank.qian

    Reviewing the steps in Documentation provided below:
    Oracle® Database Backup and Recovery Advanced User's Guide
    Migrating a Database into ASM
    http://download-east.oracle.com/docs/cd/B19306_01/backup.102/b14191/rcmasm001.htm#i1016547
    None of the choices are correct.

  • Which file gets created automatically while migrating from---QNo.113

    Which file gets created automatically while migrating from non-ASM files to ASM diskgroup by using RMAN?
    A. the contol file
    B. the alert log file
    C. the parameter file
    D. the server parameter file
    E. the archive redo log file

    Check this out
    http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10734/rcmasm.htm

  • [solved]bash help please: sort files & recognize duplicates

    Hi!
    I'm trying to move/rename all files in a folder and its subfolder by age.  And move duplicate files somewhere else. The output looks mostly fine, the tmp files too... but I can't figure out, why the duplicate files handling isn't working. edit: the line that sets the new name (&& newname="$1/.dupes/$dname/$part1_$part2_$fname" \) just doesn't seem to get executed here...
    #!/bin/bash
    pushd "$1" && {
    rafi="/tmp/$RANDOM.size.md5.list" && echo > "$rafi"
    find $1 -type f -print0 | while read -d $'\0' file;
    do \
    fname=$(basename "$file")
    dname=$(dirname "$file")
    part1=$(stat -c%y "$file" | awk -F " |:|\\\.|-" '{printf $1"-"$2"-"$3}')
    part2=$(stat -c%y "$file" | awk -F " |:|\\\.|-" '{printf $4"-"$5"-"$6}')
    echo "$bname" | grep -q "$part1" && part1=""
    echo "$bname" | grep -q "$part2" && part2=""
    newname="$1/$part1/$part2_$fname"
    size="size$(stat -c%s "$file")"
    grep -q "$size" "$rafi" \
    md5="md5$(md5sum -b "$file" | sed "s/ .*//")"
    grep -q "$md5" "$rafi" \
    && newname="$1/.dupes/$dname/$part1_$part2_$fname" \
    || {
    echo "$md5" >> "$rafi"
    } || {
    echo "$size" >> "$rafi"
    newname=$(echo "$newname" | sed "s/\/\/*/\//g" | sed "s/\.~.~//g")
    if [ "$newname" != "$file" ];
    then if ! [ -d $(dirname "$newname") ]
    then echo mkdir -p $(dirname "$newname") -v
    fi
    echo mv "$file" "$newname" -v --backup=numbered
    fi
    done
    popd
    What am I doing wrong? Been trying for hours - I just don't get it...
    Thanks!
    Last edited by whoops (2011-03-01 10:19:48)

    thx, that brought me a little closer!
    juster wrote:I don't usually say this for bash but your style is hard to read.
    Oops... thought so - never had an easy time writing readable code. Or readable anything... Maybe this is not as bad:
    #!/bin/bash
    if pushd "$1"
    then
    # random tmp file for filesize + md5
    rafi="/tmp/$RANDOM.size.md5.list" && echo > "$rafi"
    # for all files in folder $1 + subfolders...
    find $1 -type f -print0 | while read -d $'\0' file
    do
    fname=$(basename "$file")
    dname=$(dirname "$file")
    # Get year-month-day
    part1=$(stat -c%y "$file" | awk -F " |:|\\\.|-" '{printf $1"-"$2"-"$3}')
    # Get hour-minute-second
    part2=$(stat -c%y "$file" | awk -F " |:|\\\.|-" '{printf $4"-"$5"-"$6}')
    # Don't add this info to new filename if it is already in old filename
    echo "$bname" | grep -q "$part1" && part1=""
    echo "$bname" | grep -q "$part2" && part2=""
    # Destination filename
    newname="$1/$part1/${part2}_$fname"
    size="size$(stat -c%s "$file")"
    # have files with the same size already been processed?
    if grep -q $size "$rafi"
    then
    md5="md5$(md5sum -b "$file" | sed "s/ .*//")"
    # have files with the same md5 already been processed?
    if grep -q $md5 "$rafi"
    # set different destination for duplicate files
    then newname="$1/.dupes/$dname/${part1}_${part2}_$fname"
    # write md5 to tmp file
    else echo $md5 >> "$rafi"
    fi
    # write size to tmp file
    else echo "$size" >> "$rafi"
    fi
    # remove double slashes
    newname=$(echo "$newname" | sed "s/\/\/*/\//g" | sed "s/\.~.~//g")
    if [ "$newname" != "$file" ]
    then if ! [ -d $(dirname "$newname") ]
    then echo mkdir -p $(dirname "$newname") -v
    fi
    echo mv "$file" "$newname" -v --backup=numbered
    fi
    done
    popd
    fi
    Renaming seems to work correctly now, but it's still only giving me one "dupe mv line" for my test in /etc/X11 and it's not giving me any for the many duplicates in my huge digicam folder.
    $ sort_by_date /etc/X11/
    ~
    mkdir -p /etc/X11/2011-02-27 -v
    mv /etc/X11/xorg.conf.bak /etc/X11/2011-02-27/19-43-36_xorg.conf.bak -v --backup=numbered
    mkdir -p /etc/X11/2010-06-21 -v
    mv /etc/X11/xorg.conf.d/20-nvidia.conf /etc/X11/2010-06-21/10-12-35_20-nvidia.conf -v --backup=numbered
    mkdir -p /etc/X11/2010-08-24 -v
    mv /etc/X11/xorg.conf.d/10-evdev.conf /etc/X11/2010-08-24/15-45-35_10-evdev.conf -v --backup=numbered
    mkdir -p /etc/X11/2010-09-01 -v
    mv /etc/X11/xorg.conf.d/20-nvidia.conf.pacnew /etc/X11/2010-09-01/12-16-10_20-nvidia.conf.pacnew -v --backup=numbered
    mkdir -p /etc/X11/2010-11-30 -v
    mv /etc/X11/xorg.conf.d/20-keyboard.conf /etc/X11/2010-11-30/10-27-00_20-keyboard.conf -v --backup=numbered
    mkdir -p /etc/X11/2010-05-26 -v
    mv /etc/X11/xorg.conf.d/10-quirks.conf /etc/X11/2010-05-26/21-51-03_10-quirks.conf -v --backup=numbered
    mkdir -p /etc/X11/2010-01-03 -v
    mv /etc/X11/xorg.conf /etc/X11/2010-01-03/10-56-25_xorg.conf -v --backup=numbered
    mkdir -p /etc/X11/.dupes/etc/X11 -v
    mv /etc/X11/xorg.conf.dub /etc/X11/.dupes/etc/X11/2011-02-27_19-43-52_xorg.conf.dub -v --backup=numbered
    mkdir -p /etc/X11/2010-07-10 -v
    mv /etc/X11/Xsession /etc/X11/2010-07-10/20-01-30_Xsession -v --backup=numbered
    mkdir -p /etc/X11/2010-12-22 -v
    mv /etc/X11/xinit/xinitrc.d/30-dbus /etc/X11/2010-12-22/15-39-41_30-dbus -v --backup=numbered
    mkdir -p /etc/X11/2010-11-28 -v
    mv /etc/X11/xinit/xinitrc.d/40-libcanberra-gtk-module /etc/X11/2010-11-28/02-44-08_40-libcanberra-gtk-module -v --backup=numbered
    mkdir -p /etc/X11/2010-12-19 -v
    mv /etc/X11/xinit/xserverrc /etc/X11/2010-12-19/11-58-47_xserverrc -v --backup=numbered
    mkdir -p /etc/X11/2010-11-15 -v
    mv /etc/X11/xinit/xinitrc /etc/X11/2010-11-15/11-39-17_xinitrc -v --backup=numbered
    ~
    Still don't get it where this problem could be coming from...
    md5sum * 2>/dev/null | sort -k 1 | uniq -d -w 32 | cut -c 35-
    That's beautiful, just I have no idea how to use it in the context of what I'm trying to do.
    Last edited by whoops (2011-02-28 13:00:27)

  • Which file gets updated in WebLogic domain when a user is created

    Hi All,
    I have a query regarding In a weblogic domain when we create a user or group in security realm--> myrealm in Dfault Authenticator, then which file or folder under Domain directory structure gets updated?
    Thanks in Advance!!

    In the ${DOMAIN_HOME}/security directory the ldift files for the embedded LDAP are located. Also every server gets its own copy (${DOMAIN_HOME}/servers/${SERVER_NAME}/cluster-server1/data/ldap).

  • [Solved] Bash and Floating point arithmetic

    I didn't realize how troublesome floating point numbers can be until now.
    What I want to do should be simple I dare say:
    properRounding( ( currentTime - downloadTime ) / ( dueTime - downloadTime ) * 100 )
    however best I've been able to achieve so far is this:
    echo "($currentTime-$downloadTime)/($dueTime-$downloadTime)*100" | bc -l
    Which prints the correct floating point value.
    I've tried to put the result in a variable, but I must be doing it wrong as I get the most peculiar error. I can live without it, but it would make life easier.
    As for the rounding, that is a must. I've read that if you remove the -l param from bc, then it will round, but in my case something goes wrong as I just get the value 0 in return and besides, concluded after a simple test, bc always rounds down as in integer division, which I can not use.
    So of course I'll continue reading and hopefully someday arrive at a solution, but I would very much appreciate if someone could lend me a hand.
    This after all is not just a learning experience, I'm trying to create something useful.
    Best regards.
    edit:
    nb:
    all variables are integers.
    Last edited by zacariaz (2012-09-09 14:50:18)

    Just for the fun of it, here's my progress thus far... Well, there really isn't much more to do. The rest is a conky thing.
    #!/bin/bash
    # Variables from unitinfo.txt - date as unix timestamps.
    dueTime="$(date +%s -d "$(grep 'Due time: ' ~/unitinfo.txt | cut -c11-)")"
    if [ "$1" = "end" ]
    then echo $dueTime
    fi
    downloadTime="$(date +%s -d "$(grep 'Download time: ' ~/unitinfo.txt | cut -c16-)")"
    if [ "$1" = "start" ]
    then echo $downloadTime
    fi
    progress="$(grep 'Progress: ' ~/unitinfo.txt | cut -c11-12 | sed 's/ *$//')"
    if [ "$1" = "prog1" ]
    then echo $progress
    fi
    # The rest
    #progress valued 0-1 for use with conky proress bars
    progress2=$( echo 2k $progress 100 / f | dc )
    if [ "$1" = "prog2" ]
    then echo $progress2
    fi
    # Current time - unix timestamp.
    currentTime="$(date +%s)"
    # Remaining time - unix timestamp
    remainingTime=$(( dueTime-$currentTime ))
    if [ "$1" = "remain" ]
    then echo $remainingTime
    fi
    # Elapsed time - unix timestamp
    elapsedTime=$(( currentTime-downloadTime ))
    if [ "$1" = "elap1" ]
    then echo $elapsedTime
    fi
    # Total amount of time available - unix timestamp
    totalTime=$(( dueTime-downloadTime ))
    if [ "$1" = "total" ]
    then echo $totalTime
    fi
    # How much time has elapsed in percent
    progress3="$(echo 3k $elapsedTime $totalTime / 100 \* 0k 0.5 + 1 / f | dc)"
    if [ "$1" = "elap2" ]
    then echo $progress3
    fi
    # Like the above bur 0-1
    progress4=$( echo 2k $progress3 100 / f | dc )
    if [ "$1" = "elap3" ]
    then echo $progress4
    fi
    # In percent, expected completion vs $dueTime - less than 100 is better.
    expectedCompletion="$( echo 3k $elapsedTime 10000 \* $progress / $totalTime / 0k 0.5 + 1 / f | dc )"
    if [ "$1" = "exp1" ]
    then echo $expectedCompletion
    fi
    # Same as above, but unix timestamp
    expectedCompletion2=$(( downloadTime+(expectedCompletion*totalTime/100) ))
    if [ "$1" = "exp2" ]
    then echo $expectedCompletion2
    fi
    #efficiency
    if [ "$1" = "ef1" ]; then
    if [ $progress -lt $progress3 ]
    then echo "you're behind schedule."
    elif [ $progress -eq $progress3 ]
    then echo "You're right on schedule."
    else
    echo "You're ahead of schedule."
    fi
    fi
    if [ "$1" = "ef2" ]; then
    if [ $expectedCompletion -gt 100 ]
    then echo "You're not going to make it!"
    else
    echo "You're going to make it!"
    fi
    fi

  • Where do php files get read from locally?

    i've installed and tested php on 10.3.9 and it works. i'd like to parse my php files locally. i believe on older os vesions it was the 'sites' folder, but it doesn't seem to work now. where can i place my web files to test? do i have to move everything to library/apache2/htdocs?
    thank you!

    i am not running apache2 at the moment, but i am assuming the problem could result from the fact that mod_userdir.so (or its apache2 equivalent) is not enabled in your apache install, nor are your config files setup to point to the sites folder of your $HOME. for apache 1.3.x, the config file should contain something like the following after enabling mod_userdir.so. this would be particularly true if you compiled from source.
    # UserDir: The name of the directory which is appended onto a user's home
    # directory if a ~user request is received.
    <IfModule mod_userdir.c>
    UserDir Sites
    </IfModule>
    assuming you have also added the .php and .phps file types (and whatever else you want), this should get you setup.
    again - a bit of a disclaimer - i am not currently running apache2.
    -b
    DP867 MDD and 12 1Ghz PB    

  • Why doesn't my text file get read properly with BufferedReader??

    Here is my code:
    File props = new File("c:\\jdk13\\props.spm");
         FileReader in = new FileReader(props);
         BufferedReader br = new BufferedReader(in);
         String line= new String("");
         while(br.readLine() != null){
              line = (br.readLine());
              System.out.println(line);
    I also tried InputStreamReader but that didn't work right either. Basically, I want to read the lines of a text file which looks like this:
    excite.com
    hotmail.com
    yahoo.com
    with the code above, all it sems to read is "hotmail.com" and then a null. what is going on here? anybody have working examples of a BufferedReader reading lines from a text file?
    thanks in advance,
    chuck

    It's happening because you say this:
    read the first line
    put the next line in the variable line
    print it
    read the next line
    put the next line in the variable line
    print it
    read the next line - null so I'm done
    .readln does just what it says - reads the line. That said, you can do this:
    while ( (line = br.readLine() ) != null ) {
        System.out.println( line );
    }

  • [Solved] "bind" and ".inputrc"

    It seems that
    bind '"\e[11~": "Function Key 1"'
    doesn't have any effect on my machine. No ~/.inputrc is created and there are also no changes on the /etc/inputrc.
    Also creating a .inputrc in my home dir doesnt have any effect, also after reboot. Its a new system, so maybe there are any essential packages missing? I checked and tried a lot, but nothing has effects.
    Last edited by gamer01 (2013-08-19 11:58:03)

    thats the point. to include it in the .inputrc, has no effect at all.
    Appending the
    bind ...
    to my ~/.bashrc has the same effect as typing it directly after login, which means no effect too.
    As far as i know should
    bind foo
    append "foo" to the ~/.inputrc, but the file is not beeing created or edit after execution.
    Also changing stuff in the /etc/inputrc doesn't change the behavior. Do i need to activate anything, that readline/bash listens to those files?

  • The file contains file info data which cannot be read and has been ignored

    We have been sending images out to contractors, and sometimes when they come back the files are having this error:
    the file contains file info data which cannot be read and has been ignored
    When I then try to Photoshop Script the file info it throws errors.  Does anyone know what causes this error to happen?
    Thank you

    ok, Thanks!, BUT here's the bigger issue:
    We use a lot of Photoshop Scripting, and the file info is how we direct all of our workflows.  when a file comes back with "the file contains file info data which cannot be read and has been ignored" error, the scripts are unable to read/write to any of the file info ever again.  So not only did we lose all the info already in the file, but we can't use the file at all after this.
    Additonally, we tried copying and pasting to new blank documents, but realized we needed all the paths, channels, and sampler points too.
    Is there anything anyone can think of to get around this probelm?  A setting, or a program to fix the metadata, etc?
    Thanks!!!

  • Reading and writing to file , getting null when i try to  read file content

    i start by apologizing incase i have posted this question in the wrong forum
    i am trying to iterate through a directory tree and pick all the subdirectories and put them in an arraylist . on the other hand , i am picking all the files and putting them in a different arraylist . After that i iterate through the arraylist , pick a folder , create a file in it search for all the files of the same type in its subfolders and write them to the newly created file
    The problem i am running into is i i can't read the files and hence i can't write to the file .
    My directory tree is in the format
    c:\KPCData\\01\01\01\01\01\ file1_type1
    c:\KPCData\\01\01\01\01\02\ file2_type1
    where one one of the types is "covers" . i know this could be asking too much but i am at my tethers end , could someone please have a look at the code and tell me where i might be going wrong . you could zero in on the part where i have ************ before the a line of code thank you package directories;
    import java.io.*;
    import java.util.*;
    public class Directories {
    private static  ArrayList direcs= new ArrayList();
    private static  ArrayList census= new ArrayList();
    private static ArrayList vagrant= new ArrayList();
    private static ArrayList hotel= new ArrayList();
    private static ArrayList emigrant= new ArrayList();
    private static ArrayList traveller= new ArrayList();
    private static ArrayList longform= new ArrayList();
    private static ArrayList cover= new ArrayList();
    private static String parentPath = null;
    private static File mycover = null;
    private static File mytravel = null;
    private static File myemigrant = null;
    private static File mylong= null;
    private static File myinstitution = null;
    private static File myvagrant = null;
    private static BufferedReader in;
    private static BufferedWriter out;
    private static String read,toread;
    //function for listing the folder contents
    class compareDirs implements Comparator
    public int compare(Object one, Object two)
         int val=0;
         File file1 = (File)one;
         File file2= (File)two;
         String name1 = file1.toString();
         String name2= file2.toString();
         if (name1.length()==name2.length())
         val= name1.compareTo(name2);
         else
              if( name1.length()>name2.length())
                   val=-1;
              if (name1.length()<name2.length())
                   val=1;
         return val;
    private  ArrayList recurs(File dir,File file) throws IOException
         File []files=dir.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   recurs(files[index],file);          
              }//if
              else
                  census.add(files[index]);     
         }//for index
         return census;
    } //recurs
    //function for determining the number and paths of the folders
    private ArrayList numDirs(File dirs)
         File []files=dirs.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   if (direcs.contains(files[index])==false)
                   direcs.add(files[index]);
                   numDirs(files[index]);     
              }//if
         }//for index
         return direcs;
    public static void main(String[]args) throws IOException
              File myfile = new File("C:\\KPCData");
         File myfile2= new  File("C:\\KPCData\test.txt");
         Directories dir = new Directories();
         if (myfile.isDirectory())
         ArrayList myList=dir.recurs(myfile,myfile2);
         ArrayList mydir1 = dir.numDirs(myfile);
        ArrayList mydirs = new ArrayList();
        mydirs.add(mydir1.get(0));
         for (int x=0;x<mydir1.size();x++)
         {  int count=0;
              for (int y=0;y<mydirs.size();y++)
                   if (x==y)
                        count++;
              if (count<1)
                   mydirs.add(mydir1.get(x));
         Collections.sort( mydirs,dir.new compareDirs() );     
            for(int index1 =0 ;index1<mydirs.size();index1++)//print out directories
              File mydir=(File)mydirs.get(index1);
              File directory= (File)mydirs.get(index1);
              if(!mydir.getPath().contains("00"))//// if not leave node  create files for each file type
                   String name1 =mydir.getPath();
                   ArrayList ray=new ArrayList();
                   String name="K";
                 for (int index=0;index<name1.length();index++ )
                          if (name1.charAt(index)!='\\'&&name1.charAt(index)!='C'&&name1.charAt(index)!=':'&&name1.charAt(index)!='K'&&name1.charAt(index)!='P'&&name1.charAt(index)!='D'&&name1.charAt(index)!='a'&&name1.charAt(index)!='t')
                       name =name+(String.valueOf(name1.charAt(index)));
              // create a string
                  name= name.substring(1);
                   String trial = name+"_cover.dat";
                   mycover = new File ( mydir,trial);
                     if (mycover.exists()) {
                          mycover.delete();
                          mycover.createNewFile();
                      } else {
                           mycover.createNewFile();
                     String addit = mydir.getParent().toString();
                    mylong = new File (addit+"\\_long.dat");
                    if (mylong .exists()) {
                          mylong.delete();
                          //mylong.createNewFile();
                      } else {
                            //mylong.createNewFile();
                              myemigrant = new File (mydir.getParent()+"\\_emigrant.dat");
                              if (myemigrant.exists()) {
                                   myemigrant.delete();
                                  // myemigrant.canWrite();
                                } else {
                                     //  myemigrant.canWrite();
                   mytravel= new File (mydir.getParent().toString()+"\\_traveller.dat");
                    if (mytravel.exists()) {
                        mytravel.delete();
                       // mytravel.createNewFile();
                      } else {
                           //mytravel.createNewFile();
                    myinstitution = new File (mydir.getParent().toString()+"\\_institution.dat");
                    if (myinstitution.exists()) {
                          myinstitution.delete() ;
                         // myinstitution.createNewFile();
                      } else {
                           //myinstitution.createNewFile();
                    myvagrant = new File (mydir.getParent().toString()+"\\_vagrant.dat");
                    if (myvagrant .exists()) {
                         myvagrant.delete();
                        // myvagrant.createNewFile();
                      } else {
                           //myvagrant.createNewFile();
         //}//initial
              for( int index2 =0;index2<myList.size();index2++)//loop the second one for individual files
                   File file= (File)myList.get(index2);
                   if (file.getParent().contains("00"))//leave node
                        parentPath =file.getParent().substring(0, file.getParent().length()-4);
                   else
                        parentPath =file.getParent().substring(0, file.getParent().length()-3);
                   if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new  FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
    }//class Directories

    kingspalace wrote:
    Dr Clap
    The problem i am having is that whereas i am very sure that there are contents in the files i am trying to read , this part of the code Print the Values of parentPath,directory.getParent() and file.getName() here .In the start of this if condition to get a idea what stuff is coming here.
    if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                   {Are you trying to compare parentPath and directory.getParent() as Strings ? How about using equals() ?
    Also are you aware that a single & and && are not one and the same ?
    & will check nevertheless even if the string comparison on the parentPath returns true or false.
    && will not check file.getName() part if the String comparison part fails.
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
                             }How about adding a simple Exception catch block here ,in case you miss anything ?
    never gets executed executed (meaning ,according to the code, the files am reading have no content ). i am a bit new to files and directories in java . i am hence seeking advice on what i could be doing wrong .IN short,debugging your code will help you a lot.

  • Having problems opening a pdf file with reader 10/11 get error msg cannot open close reader and try again any ideas

    having problems opening a pdf file with reader 10/11 get error msg cannot open close reader and try again any ideas

    Hi George ,
    Is it happening with all the PDF' or any specific one?
    Could you please share the error message so that we can replicate at our end ?
    Try repairing reader  once and see if that fixes the issue.
    Launch Reader>Navigate to Help>Repair Adobe Reader Installation
    Regards
    Sukrit Dhingra

  • How get output generated as csv file  by reading  by buffered reader and wr

    how get output generated as csv file by reading by buffered reader and writer

    String file_location = "C\temp\csv.txt");
    try {
         URL fileURL = getClass().getResource(file_location);
         if (fileURL != null){
              BufferedReader br = new BufferedReader(new InputStreamReader(fileURL.openStream()));
              String s = br.readLine();
              while (s != null)  {
                   if (!s.equals ("")) {
                        System.out.println(s);
                   s = br.readLine();
              br.close();
         else {
              // error
    catch (IOException ex){ex.printStackTrace();}rykk
    Message was edited by: a dummy
    rykk.

  • How did my pdf files get converted from 'open with Adobe Reader' to open with Adobe Acobat'?  And if I have a ''free'' Acrobat account why does it not open?  When I do click on the account it ask me to pay $89.99.  I never wanted Acrobat.  How can I get -

    How did my stored files get converted from 'open with Adobe READER' to 'open with Adobe ACROBAT'? How can I get them re-set to open with 'Adobe Reader'?
    Please reply to my e-mail:   [email protected]

    It sounds as if you downloaded Adobe Acrobat Pro. If you did, uninstall it. Then repair Adobe Reader.
    The free Acrobat account has no connection to any of this.

  • The operation can't be completed because some items had to be skipped. For each item, choose File Get Info, make sure "Locked" is deselected, and then check t

    The following error comes up when I try to install the updated Firefox:
    "The operation can’t be completed because some items had to be skipped. For each item, choose File > Get Info, make sure “Locked” is deselected, and then check the Sharing & Permissions section. When you are sure the items are unlocked and not designated as Read Only or No Access, try again."
    When I follow the instructions in the error message, it shows that my user name has read and write access. There are a couple other items that are read only. I tried to change this to read and write, but the Sharing and Permissions options are greyed out and will not let me change them. What is the work around for this? I would really like to install the new firefox.
    Thanks.

    Hello,
    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default('''This will NOT delete profile info such as bookmarks and history'''):
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!
    Thank you.

Maybe you are looking for