Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcsh init script: unknown file attribute: i #8

Closed
priyadarshan opened this issue Aug 26, 2015 · 9 comments
Closed

tcsh init script: unknown file attribute: i #8

priyadarshan opened this issue Aug 26, 2015 · 9 comments

Comments

@priyadarshan
Copy link

Hello,

I am trying to install your nice Emacs setup, but I stumble against an issue, perhaps due to tcsh syntax?

$ source git_force_update.csh ~/.emacs.d
git_force_update.csh:7: unknown file attribute: i

I am currently on OS X 10.10.5 and my tcsh version is

$ tcsh --version
tcsh 6.19.00 (Astron) 2015-05-21 (unknown-unknown-bsd44) options wide,nls,dl,al,kan,sm,rh,color,filec
@kaushalmodi
Copy link
Owner

I have few questions and may be answering those will help resolve this:

  • Did you run the curl command + the chmod?

    curl https://raw.githubusercontent.com/kaushalmodi/.emacs.d/master/git_force_update.csh >! git_force_update.csh && chmod 744 git_force_update.csh

  • Do you have the tcsh binary in the /bin/ dir? What do you get when you do which tcsh?

Your tcsh version is fine, newer in fact. I am on 6.18.01.

The error given by tcsh seems to be misleading to me because on line 7, I have set called=($_) and there is nothing called i on that line. So my primary doubt is the file attributes of the git_force_update.csh itself.

@priyadarshan
Copy link
Author

Hi,

Yes, I was following all the steps in the README file.

My default shell is zsh. On a hunch, I logged in using the tcsh shell, and followed again all the steps.

This time it worked, with the only error:

% source git_force_update.csh ~/.emacs.d
readlink: illegal option -- f
usage: readlink [-n] [file ...]
usage: dirname path

Notwithstanding that error message, Emacs (24.5) sees the new .emacs.d just fine (fecthing ELPA packages, etc).

Are you using tcsh as your main shell?

Perhaps that is the catch, to source the script while insde the tcsh shell?

@kaushalmodi
Copy link
Owner

Thanks for the update.

Doing readlink --version gives me

readlink (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
--snip--

Doing man readlink gives me:

DESCRIPTION
       Display value of a symbolic link on standard output.

       -f, --canonicalize
              canonicalize  by  following every symlink in every component of the given
              name recursively; all but the last component must exist

The readlink portion is what I categorize as "bells and whistles" part of the script; not required. If you did not download the script to /tmp, that portion is useless.


More detail if you are interested

I put that section to aid a little alias I have for testing this script:

alias update_emacs_temp 'setenv KME /tmp/km_emacs.csh && curl https://raw.githubusercontent.com/kaushalmodi/.emacs.d/master/git_force_update.csh > ! ${KME} && chmod 0744 ${KME} && source ${KME} ~/temp/.emacs.d && unsetenv KME'

The readlink helps me get the ${script_dir} value and if that value is /tmp/, the script auto deletes itself after it is used. That way I am sure that I always get the latest version commited to git.

@kaushalmodi
Copy link
Owner

Here's something I found about readlink -f and Mac OS: http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac

Sorry I don't have access to OS X so cannot try it. But as I mentioned above, you are safe to comment out the readlink portion.

Safe to comment lines:

  • set called=($_)
    if ( "${called}" != "" ) then # called by source
    set script_file_name=`readlink -f $called[2]`
    else # called by direct execution of the script
    set script_file_name=`readlink -f $0`
    endif
    unset {called}
    set script_dir=`dirname ${script_file_name}`
  • if ( ${script_dir} == "/tmp" ) then
    # echo "Self-deleting ${script_file_name} ..\n"
    \rm -f ${script_file_name}
    endif

@priyadarshan
Copy link
Author

Thank you, I am actually quite interested in your script as well, and I find it very instructive.

As a side note, are you by any chance on FreeBSD? I also use that system (it is my main machine), and tcsh is the default shell there, at least for root user.

Thank you for your Emacs setup.

I find it congenial to my own workflow and perspective on Emacs use.

I shall start using it as my main Emacs.d now. Thank you once again.

@priyadarshan
Copy link
Author

Thank you also for the readlink pointers, I shall research it better. My installed readlink:

$ readlink --version
readlink (GNU coreutils) 8.24

@kaushalmodi
Copy link
Owner

As a side note, are you by any chance on FreeBSD? I also use that system (it is my main machine), and tcsh is the default shell there, at least for root user.

I am on RHEL 5.10. I would want to move to zsh but am tied to tcsh because that's what we have at work.

Thank you, I am actually quite interested in your script as well, and I find it very instructive.
Thank you for your Emacs setup.

Thanks for the kind words!

readlink (GNU coreutils) 8.24

That is very odd that my 2006 version of readlink (shipped with the RHEL 5.10 we have at work) had the -f option. If you do man readlink, do you see any similar option that uses something else instead of -f?

@priyadarshan
Copy link
Author

I have found the issue with readlink: while using zsh, I have the GNU readlink version coming earlier on my $PATH, while opening the temporary tcsh shell I was using the default OS X readlink, withouth the -f option.

Thanks!

@kaushalmodi
Copy link
Owner

Ah, good to know. Thanks! In any case, finding an alternative to readlink -f is on my list.. just for the sake of learning :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants