zsh-users
 help / color / mirror / code / Atom feed
From: "Nikolay Aleksandrovich Pavlov (ZyX)" <kp-pav@yandex.ru>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>,
	Zsh Users <zsh-users@zsh.org>
Subject: Re: echo "true" > ~/.zshrc from ~/.zshrc
Date: Sat, 11 Jun 2016 19:34:00 +0300	[thread overview]
Message-ID: <1553481465662840@web1m.yandex.ru> (raw)
In-Reply-To: <CAKc7PVBsCerq5-qAG21De2fQq53MNFOOShjTYQV6eS5stBCGpQ@mail.gmail.com>

11.06.2016, 19:24, "Sebastian Gniazdowski" <sgniazdowski@gmail.com>:
> 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.


  reply	other threads:[~2016-06-11 16:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11 16:23 Sebastian Gniazdowski
2016-06-11 16:34 ` Nikolay Aleksandrovich Pavlov (ZyX) [this message]
2016-06-11 17:40   ` Sebastian Gniazdowski
2016-06-11 18:05 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1553481465662840@web1m.yandex.ru \
    --to=kp-pav@yandex.ru \
    --cc=sgniazdowski@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).