ดูเหมือนสภาพแวดล้อมที่จำเป็นสำหรับระบบในการค้นหาส่วนประกอบ ruby ที่ติดตั้งไว้จะถูกระบุในไฟล์ที่ได้รับการอ่านสำหรับเชลล์ล็อกอินเท่านั้น หน้าคู่มือ bash มีสิ่งนี้เพื่อพูดเกี่ยวกับความแตกต่างระหว่างล็อกอินเชลล์และเชลล์ที่ไม่ใช่ล็อกอิน:
INVOCATION
A login shell is one whose first character of argument zero is a -, or
one started with the --login option.
และ
When bash is invoked as an interactive login shell, or as a non-inter‐
active shell with the --login option, it first reads and executes com‐
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable.
แต่ทว่า
When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist.
ดังนั้นหากตัวแปรสภาวะแวดล้อม ruby อยู่ใน/home/rails/.profileหรือ/etc/profileเป็นตัวอย่างตัวแปรเหล่านั้นจะถูกเพิ่มเข้ากับสภาพแวดล้อมของเชลล์
- โดยการเรียกใช้เชลล์ล็อกอินอย่างชัดเจนโดยใช้
su -l railsหรือsu --login railsหรือชวเลขsu - rails
- เมื่อผู้ใช้
railsล็อกอินผ่าน SSH
- โดยเริ่ม subshell
bash --loginหลังจากเข้าสู่ระบบ
หากคุณต้องการให้สภาพแวดล้อม ruby ถูกตั้งค่าโดยไม่คำนึงถึงวิธีที่คุณเปลี่ยนไปใช้ผู้ใช้railsคุณสามารถย้ายนิยามตัวแปรที่เกี่ยวข้องไปยังผู้ใช้~/.bashrcแทน
suอย่างไร(ธรรมดาหรืออะไรที่คล้ายsu -lหรือsu --?) เชลล์ล็อกอินสำหรับผู้ใช้ "rails" คืออะไร? คุณได้ปรับเปลี่ยนตัวแปร PATH ของผู้ใช้และถ้าเป็นเช่นนั้นไฟล์ใด (~/.profileหรือ~/.bashrcหรือ~/.bash_profileหรือ ... ?)