我有以下BASH函数,它接受参数并将它们显示在终端底部的一个新行中,该行被排除在滚动区域之外:
bottomLine() {
clear
# Get all arguments and assign them to a var
CONTENT=$@
# Save cursor position
tput sc
# Add a new line
tput il 1
# Change scroll region to exclude the last lines
tput csr 0 $(($(tput lines) - 3)
问题的标题说明了一切。我的候机楼里有name@name-macbook-air。我想把这个藏起来。我试过跟随。
export PS1="\W \$" // Does not work even after restarting iterm
// this works but it always put $ but I want full path too but no username and computer name
echo "export PS1='$ '" >> ~/.bash_profile
. ~/.bash_prof
我已经试过几样东西了。这是我的/etc/默认屏幕。这不管用。它仍然带我到grub屏幕,并停留在那里,直到操作系统被选中。我不想让屏幕出现。我想直接进入windows 7,任何信息都很好。
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda3)"
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=tru
我正在学习一书“开始Linux编程第四版”,第二章是关于shell编程的。第53页的例子给我留下了深刻的印象,我试着开发一个脚本来显示更多的内容。这是我的代码:
enter code here
#!/bin/bash
var1=10
var2=20
var3=30
var4=40
for i in 1 2 3 4 # This works as intended!
do
x=var$i
y=$(($x))
echo $x = $y # But we can avoid declaring extra parameters x and y, see next line
我有一个脚本(不是我自己写的),它在我的命令提示符中显示git branch/svn分支。有人知道为什么这在mac上不起作用吗?它在linux中工作得很好。
来自
# Display ps1 with colorful pwd and git status
# Acording to Jimmyxu .bashrc
# Modified by Ranmocy
# --
if type -P tput &>/dev/null && tput setaf 1 &>/dev/null; then
color_prompt=yes
else
最近,我试了一试哦,我的zsh,一切看起来都很好,直到我尝试了虚拟化和虚拟包装。当我在普通bash上激活virtualenv (例如,测试)时,我将看到虚拟化名称如下:
(test)abc@abc:
但是,当我切换到zsh时,我看不到virtualenv名称。尽管如此,我还是在我的zsh插件中添加了virtualenv和虚拟包装器。我还检查了虚拟服务器的激活文件,它包含:
f [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
_OLD_VIRTUAL_PS1="$PS1"
if [
我使用以下方法创建python虚拟环境:
python3 -m venv venv3
要激活,我source venv3/bin/activate。
venv3/bin/activate似乎并没有那么复杂:
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
# reset old environment variables
if [ -n "$_OLD_VIRTUAL_PATH"