Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: echo "true" > ~/.zshrc from ~/.zshrc
- X-seq: zsh-users 21650
- From: "Nikolay Aleksandrovich Pavlov (ZyX)" <kp-pav@xxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: echo "true" > ~/.zshrc from ~/.zshrc
- Date: Sat, 11 Jun 2016 19:34:00 +0300
- Authentication-results: mxback2m.mail.yandex.net; dkim=pass header.i=@yandex.ru
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1465662840; bh=C+IX+u1W8wIngT6pvu2jQ5n/Xxww93nJ+bi6BmnMZ9I=; h=X-Yandex-Sender-Uid:From:To:In-Reply-To:References:Subject: MIME-Version:Message-Id:X-Mailer:Date:Content-Transfer-Encoding: Content-Type; b=nojO2mivZvHmoiLcV1d2x5DKvKK9zW3HF9RipY7xNa1qEB9zKzGbjTGFEdQbfU2uK mcMYgTSAzmFDV9JEubxyYv8N5VjXEWFtJEJWuNIamjFRWY+dRg+PYs8N6uLaB5Vkki 6wIs56S2ODAnO/3/c0AbEUd41xWi+3Bvk4BFTLOk=
- In-reply-to: <CAKc7PVBsCerq5-qAG21De2fQq53MNFOOShjTYQV6eS5stBCGpQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVBsCerq5-qAG21De2fQq53MNFOOShjTYQV6eS5stBCGpQ@mail.gmail.com>
11.06.2016, 19:24, "Sebastian Gniazdowski" <sgniazdowski@xxxxxxxxx>:
> Hello,
> How legal it is to do:
>
> echo "true" > ~/.zshrc
>
> From ~/.zshrc? What can be expected?
>
> When I do (in ~/.zshrc, at last line):
>
> echo "sleep 200" >> ~/.zshrc
>
> then I'll get the sleep at next startup. When I do:
>
> echo "true" > ~/.zshrc
> echo "Hello normally ended"
>
> Then I will see the "Hello" message.
>
> But when I output much of text earlier in 400 lines long zshrc, then e.g.:
>
> /Users/sgniazdowski/.zshrc:182: command not found: fas
>
> But other time it went without errors, and without "Hello" message.
>
> Best regards,
> Sebastian Gniazdowski
What do you mean by “legal”? If you do something like this you need to understand what is going on: see `man zshmisc`, section “REDIRECTION”. Specifically `>>` appends to zshrc, `>` *empties* zshrc and then appends: nearly equivalent is `rm ~/.zshrc; echo true > ~/.zshrc`.
I personally would not suggest to *ever* edit zshrc using `echo … >[>] ~/.zshrc`: this is a script and using `echo >>` to edit it will over time turn zshrc into an unorganized junkyard. If you need to do some edits, take text editor and edit ~/.zshrc, keeping it organized. This is especially needed if you have many aliases which may alter the subsequent code.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author