![]() |
Quote:
to fully exercise your zsh startup, try: % zsh -l # or --login, to get a login shell |
Hello,
I was using just plain zsh. I tried using exec zsh but the result was the same, what actually did work is changing the prefs of terminal so that /bin/zsh gets executed when opening a new window. Edit: Tried zsh -l and --login and that didn't work either, still got that (2) there. Edit2: eek, found out what it was that was screwing my paths I had: source /etc/profile In my .zshrc. Taking that out fixed it. --- So all I need now is some color in my ls and one last question and I'm done! Sorry for dragging on this thread for so long. Oh, and on the colorized ls, I need the fink ls right? And the second question: I have a function that adds someone to my blocked list, the function needs to be run as sudo though. Before I had an alias that said basically "sudo function", is there a less kludgy way of doing it? Or would It be recommended i run sudo function every time. Last, timan mentioned that I don't have to put braces and function name in my function, is it ok to have it either way? looks a little more organized with it. ---------------- Edit3: Eek! I thought I was all done, but now I have a new problem... ::sigh:: I hope that once I get it running I can forget about shells for about a year. Look at this: Code:
% ls -athanks, V |
Good to hear that you got your PATH straightened out. I have colorized ls which I got from fileutils via fink. I wish there were a way to use /bin/ls and get a colorized ls, though. It sounds like you have ls aliased to something, so doublecheck that. Also try the full path: /bin/ls -a and see what happens. I'm not sure about a better way to include sudo within an alias; maybe someone else could anwer that one. As far as functions in ~/.zfuncs go, I think you can leave them in brackets if you like, but I'm pretty new to the whole zfuncs thing myself, so I'd check the documentation: 'man zshall' and http://zsh.sourceforge.net/
|
You are absolutely right, ls was aliased to #alias ls="ls --color=auto", so how do you do it so that you get color and the switches work?
Also, my ll function doesn't work, and I'm very much used to using it, so any ideas on how to get it to work? Basically it's the same issue, it needs an explicit path to work, here's what it looks like: Code:
ls -lag "$*" | moreCode:
ll () {My pid getter, with no arguments, spits out all the pids there are; yet ll doesn't work even though the code is pretty much identical. What say the wizards? V |
Sorry, too tired for a detailed answer just now, but here's a nasty, shallow, miserly couple of lines.
Your simple "ll" function works fine for me. In my ~/.zsh_functions directory I made a file called "ll" with a single line in it: exactly as you posted above... ls -lag "$*" | more Bingo: ll is available and works as you'd like it to. Are you sure that "ls" alias isn't running round in your shell as some kind of remnant/revenant? As for colour: sorry, I'm an "lc" person! One of very few, I'm sure, but it does what I want quite nicely (particularly when it's set up via "persistent perl", which is verging on decadence for such a simple script; but that's the joy of having a machine with a modern processor and stacks of memory sitting on your desktop!). If you've no idea what I'm talking about see the search field. Or --even easier-- just play with the script at the end of the following page: it should cut and paste fine: call it "lc", dump it in ~/bin, make it executable, and then "rehash". http://forums.macosxhints.com/showth...c&pagenumber=2 As above, it's pretty basic, but does have some virtues! Speed's probably not one of them. Cheers, Paul (who is recycling far too much lately; yech, starting to smell like a compost heap whenever I post...) |
Yep. seems like that ll of yours should work. I did the following:
% echo 'ls -lag "$*" | more' > .zfuncs/ll When I opened up a new shell, 'll .' got me the listing of the current directory. Why don't you create a test user, one who doesn't have all of your predefined aliases and settings, and test? Bear in mind that I have fpath=($zdotdir/.zfuncs $fpath) autoload -U +X ${fpath[1]}/*(:t) in my .zshenv, and that you should have something like that there too in order for the functions to work. I think. Edit: PS, you won't get color using ll, because it's piped to 'more' |
Quote:
--the "obtuse comment fruitbat" |
Aha, it's because I had --color=auto set, instead of just --color. Thanks merv ;)
|
Sorry, for joining so late to this thread... been busy lately...
Vonleigh, would you please post your zsh init files so we all can try to solve your problem... of course, if there is something you don't want to show (confidential things) you simply cut it away and done... For the record, you can create your functions without the surrounding brackets as long as each function is in its own file, if you want to put several functions in one file they must be bracketed. |
pmccann,
Thanks for your response. First I want to thank you for lc, that command is just beautiful, and it avoids me having to install findutils. Not that I have anything against them, but it installs a bunch of additional stuff like anacron, etc. that I'd prefer to avoid. Timan, the problem isn't with ll+directory, but just plain ll. For example "ll ." works, but not ll by itself; aka with no arguments. Santin, bienvenido al tema. Oh, and I found yet another problem... this is getting horrible. I can't run screen, and I looove using screen, here's what happens: Code:
%screenOh, and a quick question while I'm at it. Say I issue a command and get "permission denied", any quick way, with zsh, of doing sudo #something, with #something meaning the last command you issued exactly? Say I do "mv something /somewhere else", and it gives me an error, is there a quick command for sudo XYZ that will do "sudo mv something /somewhere/else"? I have no idea why ll doesn't work then. I did notice something odd, I edited my ll so that it was on just one line (no brackets), closed and restarted my terminal, yet which ll doesn't match cat ll: Code:
% which lsCode:
% cat .zshenv | fold -60Code:
% cat .zshrc | fold -60 |
Substitute
Code:
ls -lag "$*" | moreCode:
ls -lag $* | more |
Santin,
Perfect! It works now, thanks alot. Any ideas on the screen issue though? Also, I found something new: Code:
% sudo -sEdit: I commented out my color section and it works now (both sudo -s and screen). But here's something odd, if I do screen or sudo -s it drops me into a tcsh shell instead of a zsh shell. Any ideas? And I'm still wondering about some way of quick sudo last command. v |
Nothing about screen... yet.
However, here you have what you wanted for sudo Code:
% commandAs for the problem with the colors variable do, I usually got the same problem, it seems that that variable (I don't know what it is for) is not supported so I strip it out from LS_COLORS: Code:
eval `dircolors 2>& /dev/null | sed 's/:do=..;..://'` |
Hello,
Thanks for the !-1, that will avoid some unnecessary typing. I'm using jaguar's screen. I wonder why both sudo -s and screen drop me to tcsh, maybe I'm missing a setting somewhere, I'll google it just in case. thanks, v |
Have you tried sudo -s and screen after stripping out the do variable from LS_COLORS?
I think it may be the cause of your problems... Hope you get to solve it, I'm going to bed now as it is a bit late here in Spain...:o Hasta mañana! |
Hello,
I actually eliminated that whole section from my zshrc (export ls colors and the definition) since I'm using Paul's lc. Closed, opened a new session but still it drops me to tcsh on screen and sudo -s. Que duermas bien, gracias por la ayuda. v |
Wohoo!
Figured it out: Netinfo. Changed my shell to /bin/zsh instead of /bin/tcsh. Now screen and tcsh put me in the right shells. Now I have trouble with the prompt, lol. Maybe the prompt wizards can help me out: Standard prompt: Code:
{05:35 PM Code:
{05:36 PM Code:
{05:36 PM myprompt () { local WHITE=$'%{\e[0;37m%}' local GREEN=$'%{\e[0;32m%}' local NOCLR=$'%{\e[0;0m%}' local RED=$'%{\e[0;31m%}' local BLUE=$'%{\e[0;34m%}' local CYAN=$'%{\e[0;36m%}' local VIOLET=$'%{\e[0;35m%}' local NEWLINE=$'\n' if [ $UID = 0 ]; then #I am root PS1="${CYAN}{${RED}%(00t:DING!:%D{%I:%M %p}) %~${CYAN}}$BLUE%(2L:(%L):)$CYAN%# $ {NOCLR}" else #I'm not root PS1="${CYAN}{${WHITE}%(00t:DING!:%D{%I:%M %p}) %~${CYAN}}$BLUE%(2L:(%L):)$CYAN%# ${NOCLR}" fi } So all and all I think i'm ready to start using zsh full time! I guess all that's missing is some good prompt customizing to get it just... perfect. Thanks all for a very enlightening journey, now it's time to have fun :) v [edit: smilies off -mt] |
Whoops! First, you should put 'fortune -a' in ~/.zprofile, not ~/.zshrc. Second, let me give you the prompt with the correct spacing:
myprompt () { local WHITE=$'%{\e[0;37m%}' local GREEN=$'%{\e[0;32m%}' local NOCLR=$'%{\e[0;0m%}' local RED=$'%{\e[0;31m%}' local BLUE=$'%{\e[0;34m%}' local CYAN=$'%{\e[0;36m%}' local VIOLET=$'%{\e[0;35m%}' if [ $UID = 0 ]; then #I am root echo "" echo "CHEATS ENABLED" PS1="${CYAN}{${RED}%(00t:DING!:%D{%I:%M%p})%~${CYAN}}$BLUE%(2L:(%L):)${CYAN}%# ${NOCLR}" else #I'm not root PS1="${CYAN}{${WHITE}%(00t:DING!:%D{%I:%M %p}) %~${CYAN}}$BLUE%(2L:(%L):)${CYAN}%# ${NOCLR}" fi } myprompt I'm glad this is starting to come together for you. ¿Y como es que alguien llamado vonleigh (que no es un nombre hispano) habla español? Then again, I gues Titanium Man isn't a Hispanic name either ;-) |
Hello,
Ah good, the prompt behaves a lot better now. I tried putting fortune -a in my .zprofile but I get: /Users/username/.zprofile:1: command not found: fortune So I guess the profile is being run before finks init.sh. I guess I'll leave it in my .zshrc for now unless someone has a better suggestion. But I can see the problems with it being there, as fortune gets run at odd moments. The prompt still gives me a (2) in both root and screen mode, is that on purpose? I tried creating a second screen within the first in case it would maybe change to (3) or so, but it stayed at (2). Edit: Uhm... now that it's practically working perfectly, hows about sharing some of these wonderful tips that make it so nice to use zsh? Any custom functions? ideas tips and tricks? I did follow the earlier thread, so I'm thinking beyond those. v P.D: lo que pasa es que soy de Venezuela; de ahí que el español es mi lengua materna. Tampoco pensé que titanium Man hablara español :) |
Regarding 'fortune -a' not working, that's odd; I'm not sure what's going on yet (works fine for me). I can, however, fix the number 2 appearing in your prompt if you don't like it. It's there because when you do 'sudo -s' you start a subshell:
% echo $SHLVL 1 % sudo -s Password: # echo $SHLVL 2 So I include %(2L:(%L):) in my PS1 so I know if I'm in a subshell or what. If you want to remove that, you can do this as your prompt: myprompt () { local WHITE=$'%{\e[0;37m%}' local GREEN=$'%{\e[0;32m%}' local NOCLR=$'%{\e[0;0m%}' local RED=$'%{\e[0;31m%}' local BLUE=$'%{\e[0;34m%}' local CYAN=$'%{\e[0;36m%}' local VIOLET=$'%{\e[0;35m%}' local NEWLINE=$'\n' if [ $UID = 0 ]; then #I am root echo "" echo "CHEATS ENABLED" PS1="${CYAN}{${RED}%(00t:DING!:%D{%I:%M %p}) %~${CYAN}}%# ${NOCLR}" else #I'm not root PS1="${CYAN}{${WHITE}%(00t:DING!:%D{%I:%M %p}) %~${CYAN}}%# ${NOCLR}" fi } myprompt As for simple reasons I like zsh: If I want to list only directories: % ls -d *(/) If I want to list only files: % ls *(.) I can autocomplete man pages by typing a few letters and hitting the Tab key: % man if if if_indextoname if_nametoindex ifnames if_freenameindex if_nameindex ifconfig Note that to do this you have to put compdef _man in your .zshrc. There is a TON of other stuff that can be done just using zsh as an interactive shell (ie even if you never write a single shell script). But read through the man pages, and check out http://zsh.sourceforge.net/Doc/Relea..._13.html#SEC59 |
| All times are GMT -5. The time now is 06:13 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.