/etc/profile.d scripts

A while ago, I was helping a friend installing archlinux on his laptop.
He wanted to use tcsh as his main shell, as he is used to this from FreeBSD.
We then discovered that his path was never updated after installing new packages (for instance firefox) and then running source /etc/profile
The reason, we later found out, was that most (if not all) of the scripts in /etc/profile.d does not have a valid shebang (usually the top row of a script, looking something like #!/bin/sh , telling the computer which shell to run the script in).
This, in combination with tcsh (and probably csh as well, we never tested that though), results in our problem, since tcsh does not have the command export, which is built in in bash (and sh, zsh, and most of other shells out there).
Tcsh uses the command set instead.
My little question is this: Why doesn't those scripts have proper shebangs, so that it would be possible to use archlinux with tcsh?
Does anybode have a good answer to that, and is this something that should be corrected in some way?

As those files are getting sourced through /etc/profile they don't need a proper shebang.
The only distro I know with support for csh is Slackware, don't expect it in Arch.

Similar Messages

  • Scripts in /etc/profile.d seem not to work under certain circumstances

    While already logged in, if I open up a terminal and run a script in /etc/profile.d/ to set environment variables, the changes don't seem to take. I can think of two examples:
    1) Turning on KDE4 desktop integration in openoffice. I edited /etc/profile.d/openoffice.sh and changed OOO_FORCE_DESKTOP=KDE4, but when I ran the script I got an "export: command not found" error.
    2) When replacing Sun Java with OpenJDK in order to compile and use 389-console from the AUR, I got caught up on one of the dependencies, ldapjdk (also from the AUR). The PKGBUILD for this package contains the following block of code:
    which ant
    if [ $? -eq 1 ]; then
    . /etc/profile.d/apache-ant.sh
    fi
    ant dist
    In theory this should work, as /etc/profile.d/apache-ant.sh contains the following two lines:
    export ANT_HOME=/usr/share/java/apache-ant
    export PATH=$PATH:$ANT_HOME/bin
    However, upon running makepkg I got an error about "ant" not being in my path. To get around this I just edited the PKGBUILD and put the full path to ant, but this shouldn't have been necessary. The original PKGBUILD should have worked. I seem to have something out of whack and I don't quite know what. If anyone could be of assistance, it would be much appreciated.

    I'm well aware of this. I never said that I started openoffice from the plasma menu. I never even started it. /etc/profile.d/openoffice.sh errored out without setting the environment variable in the current shell session. If it had worked, I would have been able to run openoffice from the terminal to test the new environment variable, which is what I was intending to do in the first place. There's no need to logout to test these sort of changes, they can be done from the terminal.
    Your solution also doesn't address the problem I had in example #2, either. makepkg should be able to set environment variables in the current shell session, using the /etc/profile.d script detailed in the example. Running makepkg has nothing to do with my graphical session.
    I know that logging out and back in will "fix" the problem, but that's not the point. The point is that a script which should be able to set an environment variable is not working properly.
    Last edited by archtaku (2010-08-21 00:58:53)

  • Startup scripts in rc3.d not sourcing /etc/profile

    I'm trying to set some global parameters for the entire system e.g. JAVA_HOME
    I have placed these in /etc/profile
    If I login in as whoever /etc/profile is sourced.
    However when the system boots up /etc/profile is not sourced before a startup script e.g. /etc/rc3.d/S99xxxx is called
    Why is this and where can I set global parameters so that they are visible in the startup scripts and for anyone logging in etc.?

    /etc/profile (and $HOME/.profile) are not normally sourced by non-interactive shell invocations.
    Modify the script to source it explicitly if that's what you want.
    Darren

  • /etc/profile doesn't get sourced at start of session

    Hello to everyone :D. I've been using Windows my entire life until January when someone recommended me Ubuntu. I tried (and loved it) for some months but got sick of the lack of control, the pre-installed packages and the incorporation of Unity in 11.04, so went all out for Arch.
    It took me 2-whole-days to install everything correctly (because of issues related with the PC rather than Arch itself) and I've been configuring it bit by bit in the last two weeks (wasted my whole winter vacations on it, but it was worth it :P), ran through a lot of trouble which I've been (somehow) able to overcome almost completely by just using the Wikia (and Googling through old forum posts). I also learned a whole lot about Linux in that time and I'm very happy with my new system :D. So a thanks a lot to all the community for the great documentation you've developed, it really made a complete Linux-newbie (with a whole lot of patience :P) get a working system all by himself which is saying a lot.
    ------------------------------------------------------------------START READING HERE TO SKIP PERSONAL INTRO :P ---------------------------------------------------------------------
    However right now I'm having a couple of minor issues which don't prevent me from enjoying the system but I would rather fix in order to have a clean system (and avoid further trouble in the future). I have LXDE installed with Slim as a login manager which I start through inittab in run level 5 to start X (relevant files attached at the end of the post). The system was working perfectly but I noticed that my session wasn't being registered by ConsoleKit (it didn't appear in the "who" command which was a problem for some scripts I was building) so I read the wikia and added the following lines at "slim.conf":
    sessionstart_cmd    /usr/bin/sessreg -a -l $DISPLAY %user
    sessionstop_cmd     /usr/bin/sessreg -d -l $DISPLAY %user
    Which happily made the session appear at the "who" command as I needed. However some days after that, for no apparent reason (actually me touching config files probably), my PATH environment variable was wrong after booting (just had the /bin and /usr/bin on it, not /sbin or /usr/sbin). This just happens when I boot directly to X, when booting from a terminal the variable value was correct.
    After some research (and adding debugging commands in the initialization scripts) I concluded that my "/etc/profile" script wasn't getting ran when I boot directly to X. In order to bypass this problem temporally I made a (absolutely horrible and temporal) patch by adding the line "source /etc/profile" at ".xinitrc" which sourced the file and gave me the right value for the PATH variable. However by doing it seems I ruined the former problem and my session doesn't appear at the "who" command again :S (by removing it again, the session appears again but the PATH variable is wrong). So I've been searching exactly when /etc/profile is sourced and, apparently, it's when the "login" command is executed (which I guess is done by either the LXDE session or Slim itself).
    Since none of these packages got updates when the problem appeared I'm pretty sure it must have been one of my editions of the config files. So I leave the ones I think are relevant to the issue (and the ones that I tinkered it with the most).
    If anyone has the time to point me in the right direction I would greatly appreciate it:
    /etc/rc.conf: http://pastebin.com/qd5xYYsT
    /etc/inittab: http://pastebin.com/M1h60Hym
    /etc/slim.conf: http://pastebin.com/iaRqya07
    /etc/profile: http://pastebin.com/JLtNCMtn
    ~/.xinitrc: http://pastebin.com/XGrNuhpv
    My rc.local file is completely blank and rc.sysinit and rc.multi haven't been modified from their default values. If you need any more files, logs or any kind of experiment to gather more info just let me know and I'll post it as soon as I read it.
    Thanks a lot in advance :-).
    Last edited by facucosta (2011-07-27 08:29:50)

    There is quite some confusion about the different startup files For real terminal work you can check the bash manual. Graphical login managers however do not always follow these rules even though Slim should read /etc/profile as /etc/slim.conf seems to invoke bash with --login... You could try to put the settings in /etc/environment (see the arch wiki). There might also be a slim specific bug
    --edit--
    On second look line 35 seems odd in your slim.conf. You could try to change it to:
    login_cmd           exec /bin/sh --login ~/.xinitrc %session
    Last edited by FarmerF (2011-07-27 11:10:15)

  • When is /etc/profile called?

    with my current boot/startup/login method (see below), /etc/profile is not being called. a little bit of googling tells me that /etc/profile is called at startup - but i'd like to know exactly when and by what. is it only called at bash login? what kind of magic does GDM do to call it?
    i added a script /etc/rc.d/startx:
    #!/bin/bash
    case $1 in
    start)
    su jakob startx&
    stop)
    killall X
    restart)
    echo "invalid argument"
    esac
    and put startx in the DAEMONS array in /etc/rc.conf

    Have your checked that startx is in /etc/rc.d/ folder? . If I remember correct the 'profile' is to be placed at the last position in you grub (menu.lst) of booting kernel.

  • /etc/profile isn't sourced on startx

    the command
    source /etc/profile
    isn't used on startx
    and now all paths and locales aren't set, has anyone an idea whats wrong here?
    if i login on console it behaves normal. But if i login on X with qingy or slim it doesn't work.
    It also doesn't work if i startx on a console with /etc/profile sourced.
    i hope someone can help me.
    so long
    ukognos

    but if i run X, there's no locale set, or environment variable, so how can i set that at startup of X?

  • [SOLVED] How do I set the default umask? Not in /etc/profile

    Hi guys
    This is probably not what you expect to hear about umasks... I have set it in /etc/profile:
    [2] ognyan@xxxlinux : ~ >grep umask /etc/profile
    #Set our umask
    umask 002
    If I log on via ssh, my umask is 0002. I can start a vnc server and a konsole inside, which has umask 0002. So far so good...
    I also have a vnc server running as a service. If I open a konsole from inside this vnc, bash says umask 0022. So there must be a more-default setting for umask, than /etc/profile. I found a setting in /etc/login.defs and changed it to "UMASK 007", then even rebooted, but bash inside the vnc service stays with umask 0022.
    It seems not to be a setting of KDE, since both vnc sessions have different umasks, inherited by their parents. What provides the environment for the service and how can I control it?
    Last edited by bigblondewolf (2013-12-11 08:37:26)

    on my server i have something like this in ~/.profile:
    # the default umask is set in /etc/profile; for setting the umask
    # for ssh logins, install and configure the libpam-umask package.
    umask 002
    and at home i have ~/.bash_profile, but no umask in it.
    or is this answer too obvious? not quite sure i get your problem.

  • /etc/profile: line 28: ulimit: max locked memory: cannot modify limit: Oper

    Hi;
    I writed one sh which is checking tablespace size and its working well ( i used this before for someother client) Now i try to run it on one server and i have this error:
    /etc/profile: line 28: ulimit: max locked memory: cannot modify limit: Operation not permitted in /var/spool/mail/root
    Anyone has idea what is problem?
    Thanks

    Well, check line 28 of /etc/profile, and see what command it is trying to execute. If it's a ulimit -l command, check if the value it is trying to set the limit to is higher than the current ulimit value of the current user. If it is, then that operation is not allowed. You can increase the limit for the current user (at login time) by modifying /etc/security/limits.conf . This is documented in the various guides, notes, whitepapers that talk about installing Oracle database on Linux.

  • Help with pico /etc/profile

    I have redhat 7.3 and i install the sdk. Its in usr/java/j2sdk1.4.1/bin
    Where exactly do I put the line path so every user can use the java/javac etc commands anywhere. I tried. but it dont work. Im I clicked on save settings, but im not sure that saves it. I was trying to follow the other thread instructions but everyone seems kinda different. Im very new to linux by the way. Think i installed it by accident :P
    # /etc/profile
    # System wide environment and startup programs, for login setup
    # Functions and aliases go in /etc/bashrc
    pathmunge () {
    if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
    if [ "$2" = "after" ] ; then
    PATH="$PATH:/usr/java/j2sdk1.4.0/bin"
    else
    PATH=$1:$PATH
    fi
    fi
    # Path manipulation
    if [ `id -u` = 0 ]; then
    pathmunge /sbin
    pathmunge /usr/sbin

    It seems to me that when ".plist" files contain references to other files or folders, most require full paths and they won't accept anything to represent a generic "home". Either that, or items are represented by "alias" data, referring to a specific file, which would be completely independent of paths. That of course means that any sort of "template" account must avoid containing references to items within the "home" folder because the template will contain references to the original items, not their counterparts in the new user's home. Note that things like the "sidebar" in a regular account or the "Dock" in a "Simple Finder" do contain shortcuts to items within the "home" folder, but these aren't generated from ".plist" files in the template but rather are generated on the fly by "Finder" during login.
    In the case of the default download location for "Safari", I think it defaults to the user's "Desktop" in the absence of a ".plist" file. However, if the user changes the location, then a ".plist" file is created at that point. It would also appear that the default download location is set to the user's "Desktop" if the default Safari "home page" is changed, which also causes the same file to be created. The file appears to be: "~/Library/Preferences/com.apple.internetconfigpriv.plist"
    I haven't tested this to see if it would work, but it might be possible to modify your existing template to remove the reference to the "download folder" while retaining the desired Safari "home page" using something along these lines:<pre style="overflow:auto; padding: 5px; width: 500px ; font-size: 10px; border:1">sudo defaults delete /System/Library/User\ Template/English.lproj/Library/Preferences/com.apple.internetconfigpriv DownloadFolder</pre>

  • Build fails no /etc/profile.d/gnome.sh

    I am trying to build gnome-system-tools and I keep failing here:
    [root@localhost system-tools]# makepkg -i
    ==> Making package: system-tools-backends 1.2.0-1 (Fri Sep 21 12:26:10 EDT 2007)
    ==> Checking Runtime Dependencies...
    ==> Checking Buildtime Dependencies...
    ==> Retrieving Sources...
       -> Found system-tools-backends-1.2.0.tar.bz2 in build dir
       -> Found archsupport.patch in build dir
    ==> Validating source files with md5sums
        system-tools-backends-1.2.0.tar.bz2 ... Passed
        archsupport.patch ... Passed
    ==> Extracting Sources...
       -> tar -xf system-tools-backends-1.2.0.tar.bz2
    ==> Removing existing pkg/ directory...
    ==> Starting build()...
    PKGBUILD: line 20: /etc/profile.d/gnome.sh: No such file or directory
    What am I missing?  Why no /etc/profile.d/gnome.sh?
    I am running Gnome 2.18.3 and starting it with gdm.  Totally lost at this point.
    Thanks

    The output in your post says you're trying to build system-tools-backends, not gnome-system-tools. According to the relevant AUR page, that package was submitted over two years ago, and hasn't been updated since. The upstream release date for system-tools-backends 1.2.0 was 08 March 2005.
    Find a more recent release, and see if that builds correctly for you.

  • Something similar to /etc/profile in LDAP?

    My /etc/profile contains a logging feature which tracks the history of a local user. It doesn't work for ldap users though since I don't think LDAP looks at this file when ldap users login to a client.
    Is there some way to make ldap users use this file as the initial login profile or is there some way to setup something similar in LDAP? ldapaddent won't add this file. The only thing I can think of is to make some sort of change on cn=default,ou=profile,dc=example,dc=com but I'm unsure as to whether that will work or how exactly to set it up.
    Any help on this would be appreciated. Thanks.

    Hi Liam. Thanks for your reply. When I used the Update Credit Card option and tested the form, I got the error message "Credit Card Payment Failed….Invoice Number Not Found". But after search for that error message in this forum, I found out that I should be using the "Credit Cards (existing orders)" option. This has worked, ie payment was successfully processed and was applied to the existing order; a new invoice was not created. I have received a receipt from the payment gateway (eWay) but not one from BC. Also, upon successfully submitting the form, I was then taken to a totally blank page. I'll have to do some more testing to see whether the blank page was just a one off. If not, I'll try adding code in the Action part of the form to redirect to specific page.
    So thanks for your help. Though it didn't give me the correct answer, it l led me to it.

  • Can anyone post a mostly-default /etc/profile? I deleted mine -.-

    I was trying out some vim commands and accidentally wiped my /etc/profile -.-
    I've replaced some of the basic stuff like $PATH, but it still looks far shorter than the previous version. I also found some other examples on the web but I'd like to have the Arch defaults back and customize from there (: Could someone post theirs? Thanks a bunch.

    $ cat /etc/profile
    # /etc/profile
    # This file is intended to be used for ALL common
    # Bourne-compatible shells. Shell specifics should be
    # handled in /etc/profile.$SHELL where $SHELL is the name
    # of the binary being run (discounting symlinks)
    # Sections taken from SuSe's /etc/profile
    # Note the explicit use of 'test' to cover all bases
    # and potentially incompatible shells
    #Determine our shell without using $SHELL, which may lie
    shell="sh"
    if test -f /proc/mounts; then
    case $(/bin/ls -l /proc/$$/exe) in
    *bash) shell=bash ;;
    *dash) shell=dash ;;
    *ash) shell=ash ;;
    *ksh) shell=ksh ;;
    *zsh) shell=zsh ;;
    esac
    fi
    # Load shell specific profile settings
    test -f "/etc/profile.$shell" && . "/etc/profile.$shell"
    #Set our umask
    umask 022
    # Set our default path
    PATH="/bin:/usr/bin:/sbin:/usr/sbin"
    export PATH
    # Export default pkg-config path
    PKG_CONFIG_PATH="/usr/lib/pkgconfig"
    export PKG_CONFIG_PATH
    # Some readline stuff that is fairly common
    HISTSIZE=1000
    HISTCONTROL="erasedups"
    INPUTRC="/etc/inputrc"
    LESS="-R"
    export HISTSIZE HISTCONTROL INPUTRC LESS
    # Load profiles from /etc/profile.d
    if test -d /etc/profile.d/; then
    for profile in /etc/profile.d/*.sh; do
    test -x $profile && . $profile
    done
    unset profile
    fi
    # Termcap is outdated, old, and crusty, kill it.
    unset TERMCAP
    # Man is much better than us at figuring this out
    unset MANPATH
    And, you could retrieve that file from core/filesystem too.
    Last edited by hullap (2010-04-04 11:52:47)

  • Help! -sh: /etc/profile: is a directory!

    My PowerBook was locked, so I hold down the power button to reboot and this come up:
    -sh: /etc/profile: is a directory
    -sh-2.05b#
    I have read some posts on this forum, I got to the part where I type fsck -y, showed:
    /dev/rdisk0s5
    Root file system
    Checking HFS Plus volume.
    fsck_hfs: Volume is journaled. No checking performed.
    fsck_hfs: Use the -f option to force checking.
    so I typed fsk -f, this showed:
    /dev/rdisk0s5
    Root file system
    Checking HFS Plus volume.
    Checking Extents Overflow file.
    Checking Catalog file.
    Invalid record count
    (4, 12)
    Volume check failed.
    Can anyone help? any help will be appreciated...
    Message was edited by: lxxl

    Hello and thanks for replying so quickly,
    Well I got an install disk and I rebooted with C holding down, but here comes another problem, I got the panic:
    panic(cpu 0 caller 0x002E0BF4): Unable to find driver for this platform: "PowerBook3,5".
    Latest stack backtrace for cpu 0:
    Backtrace:
    0x00099EA4 0x0009A860 0x00027A28 0x002E0BF4 0x002BCC60 0x002BDDB0 0x002BFC28 0x002BED3C
    0x000ADE14
    Procedding back via exception chain:
    Exception state (sv=0x0125EA00)
    PC=0x00000000; MSR=0x0000D030; DAR=0x00000000; DSISR=0x00000000; LR=0x00000000; R1=0x00000000; XCP=0x00000000 (Unknown)
    Kernel version:
    Darwin Kernel Version 8.6.2: Thu Apr 13 18:51:54 PDT 2006; root:xnu-792.9.59.obj~1/RELEASE_PPC
    No debugger configured - dumping debug information
    MSR=00001030
    Lastest stack backtrace for cpu 0:
    Backtrace:
    0x00099EA4 0x0009AA58 0x00027A28 0x002E0BF4 0x002BCC60 0x002BDDB0 0x002BFC28 0x002BED3C
    0x000ADE14
    Procedding back via exception chain:
    Exception state (sv=0x0125EA00)
    PC=0x00000000; MSR=0x0000D030; DAR=0x00000000; DSISR=0x00000000; LR=0x00000000; R1=0x00000000; XCP=0x00000000 (Unknown)
    Kernel version:
    Darwin Kernel Version 8.6.2: Thu Apr 13 18:51:54 PDT 2006; root:xnu-792.9.59.obj~1/RELEASE_PPC
    panic: We are hanging here...
    Message was edited by: lxxl

  • Aterm now opens with source /etc/profile

    I was in aterm when I did source /etc/profile, but now whenever I open aterm I get the results of source /etc/profile. Xterm doesn't do this, only aterm. Why is it doing this and how can I fix it?

    just add "source /etc/profile" (without the quotes) to .bashrc (thats located in ur home directory)

  • Not executing /etc/profile

    Hi,
    I installed 10.4.2 from the CD that came with my PowerBook. Later, realising that X11 was not installed automatically, I reinstalled the entire OS using the custom mode. The old OS was shifted to PreviousSystem, which I deleted subsequently.
    I notice that on booting, the command /etc/profile is not executed. As a result, the system wide PATH that should be available for all users does not get set up. Is there a bug or am I looking at the wrong profile file?
    For individual users, .bash_profile is not automatically executed. Every time I have to issue the command "source .bash_profile" to execute them. I have the same question as above: is there a bug, or am I looking at the wrong file?
    Thanks.
    Kannan

    /etc/profile is not supposed to be executed on booting. It and .bash_profile are only executed when a login bash shell is started. A new Terminal window starts a login shell; xterm does not. A non-login shell runs .bashrc. If you are using xterm, and want to run the profiles, you can source them in your .bashrc.

Maybe you are looking for

  • Video capture driver for MSI GeForce 2 Pro video card

    Hi,  I am in need of the nVidia WDM video capture driver for my Geforce 2 Pro video card. Model #M-8831. I was able to download it from the MSI/TW website over a year ago just fine. My computer crashed from a game bug a couple of months ago and MSI/T

  • M4P files don't seem to work in Imovie HD

    I am having trouble using M4P songs I purchased on Itunes in Imovie. They cause the Ken Burns effect to be shaky. I do not have the same problem when I use music I imported from CD's. Has anyone else had this issue?

  • 1z0-051: SQL Fundamentals objective inquiry

    Hi, first of all I wish if this is the right way/ forum to ask. If not, please accept my apologies, in advance. I'm preparing for 1z0-051 Oracle Database 11g SQL Fundamentals 1 exam. My main refrence is : OCA Oracle Database 11g SQL Fundamentals I Ex

  • Using regular expressions to get a customized output

    Hi, I have a string/varchar variable with the data ',a,b,c,' in it. I want the display as follows: a b c I would like to get the similar output using regular expressions. How do I get this output using REGEXP_REPLACE or REGEXP_SUBSTR? Please do the n

  • Boris Title 3D -Can't Skew all of a sudden

    I previously had been able to skew text in Boris 3D. After a few weeks off, I re-opened it and tried again, but the text won't skew now. I have the text selected (I'm following a DVD tutorial) and have gone over it several times with no luck. I have