From nobody Fri Dec 08 16:16:26 2023 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Smx950QvTz52yRk for ; Fri, 8 Dec 2023 16:16:41 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.kundenserver.de", Issuer "Telekom Security ServerID OV Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Smx944zkQz3HST for ; Fri, 8 Dec 2023 16:16:40 +0000 (UTC) (envelope-from freebsd@edvax.de) Authentication-Results: mx1.freebsd.org; none Received: from terra.edvax.de ([178.12.32.54]) by mrelayeu.kundenserver.de (mreue010 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MkYHO-1reyKJ10qU-00lzdO; Fri, 08 Dec 2023 17:16:37 +0100 Received: from r56.edvax.de (r56 [10.200.1.11]) (authenticated bits=0) by terra.edvax.de (8.17.1/8.17.1) with ESMTPA id 3B8GGWb2022080; Fri, 8 Dec 2023 17:16:32 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Fri, 8 Dec 2023 17:16:26 +0100 From: Polytropon To: LuMiWa Cc: FreeBSD Questions Subject: Re: sh shell Message-Id: <20231208171626.54bd2581.freebsd@edvax.de> In-Reply-To: <20231208052849.00987310@dismail.de> References: <20231208052849.00987310@dismail.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:pF0paMdLEuumnO7xEdSECG4WpGxZGvEpePN6qCuCysFTXB3cXYr BnRbsli6ic7oWT5tdoR7cTpjeoq3zzOxy9Cq3t9dlY4ZyUaz74BwsZN/b0XCxxT6ahvNWUS Z34AvigMmcG6msVLRKbyz3Rvtax9fpTUsnNOy6D5/KF3X8kUP6E8d/Yp/emvg/FDMnQ9Swu 2shN2E+pkWX+xrelxbJ0Q== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:C+dRD59bsXQ=;mupBD0VqNYRAwprsDuxSs1DDO28 QrK7T2BGMXvBwRUVw9efno3rPThCwncf8jDzplYtsqaHYxU95ss9YgQ5Ny82S215HE9an3tkV zjh6zeTTji5qqNYo5dY06IxSTUXpmoOi9urCgmM9ilKip7DaIjyQIEDmspnT9a80j0IsdZwFR gxuVSSru6rWFL/uRiF8m5NO8XYCdj+opap++Z+4R1kaM6UO7ZUMaMWmOCknBktXmdhHH390rI vk0RrLXapRPY5279z61pykQesbP1L8dY7EFTg5P7oH5s4aelf6190nkbz3iSWf5WAcOWGd2xn cTeZ6VNYkZbx/mT9s0xZNCV3/DRVBeTxb+P7NI2Y4DRV4zXULHzG09G0KSaih90msfY4KISM2 UpEOkTigkxsivEcOYtBc5+J/wWJMr/OXafm3OTL6oexTJg502wksesrgpzqaef/tEByBqTfJL aOtCuGeezHCJl4q1RU+jsS9+Bp+KpZVJPDD/Zob9padh3ucpsD1hMJU5+gYP0GnyxrK+z8NeU MlbbSFTizodj0h5rfhvrdJr/8ZU99OGQld3W2qDsZwAurXROaGm5SiZOqtGnce4tNsr457r85 jAoMwCmlt61+hiupFe685kdR2M8N5ymFAfMMq79Q1gAqnosIpbOfXrE+IfM08jKM6Q9a1FhPg 6OXNqXiB/m0CcwwAqOdOqpliqEwS7IsJlY3cTGq8Dxs3FCPiks2ensI/AG76Lh9z1XJmt/BIL YLfv6Ldf5GgmvCA7JbaPFreXJv2M/EMIjD7gk6grNL/VX8dBh+4Ud4AyysevO8XiyYw2FV1S3 PPAxmwNKGhYmSZkUrkOh1TJvxhZfDFetjCmWbiwHZjIoOb2uNvQAjMOkkMekepbWhNmkjiEGu jT5t8I2Uq65Atdw== X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE] X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4Smx944zkQz3HST On Fri, 8 Dec 2023 05:28:49 -0500, LuMiWa wrote: > I have FreeBSD 14.0-RELEASE-p2. Root shell is sh and user ksh. > In the root directory is .shrc and .sh_history which settings using if I > log as root or su -. But if I use just su if as I read should use also > root settings but it doesn't. It use .cshrc. Is it correct or I have > somewhere wrong setting, please? The commands "su -" and "su -l" serve the same purpose: They call the specified user's (or root's) shell as a login shell, so that shell will read the appropriate startup files. In case of the C shell, those are ~/.cshrc and ~/.login. The opposite of "su -l" (full login) is "su -m", which will keep the caller's environment and only start the shell, but not as a login shell. The shell's behaviour can be different on how it is called: as a login shell, as an interactive shell, or as a script shell; similarly, the files read on shell startup can be different, and there is precedence with possibly existing files in /etc or /usr/local/etc for global (vs. user-local) shell settings. However, you wrote "Root shell is sh and user ksh. [...] But if I use just su [...] It use .cshrc." - no, sh will not use ~/.cshrc. The startup and configuration files are listed in "man sh" (and "man csh" lists other files). So for a full login including getting the desired user's shell settings, "su -" or "su -l" is desired; "su -" is the common way to achieve this to become root. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...