Rename detailed information before $ in Terminal [closed] - shell

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am using Terminal(Mac) for git.
When I use it shows mySystemName-MacBook-Pro:CurrentWorkingDir mySystemName before $ sign.
In my case the whole content is too long and hardly remains few space to write commands.
I want to rename it and use a alias so that there may be more space for the git commands.
In Short I want From this:
mySystemName-MacBook-Pro:CurrentWorkingDir mySystemName $
to this:
aliasName $

PS1="aliasName \$ "
man bash
...
PS1 The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is ‘‘\s-\v\$’’.
...
PROMPTING
\w the current working directory, with $HOME abbreviated with a tilde
\\ a backslash
...
...
...

Related

Bash quotes command not found [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I copied and running the command on my ubuntu 18.04 from here
https://kite.com/linux/ but got an error like:
$ bash -c “$(wget -q -O – https://linux.kite.com/dls/linux/current)”
bash: “”: command not found
$ type quote
quote is a function
quote ()
{
local quoted=${1//\'/\'\\\'\'};
printf "'%s'" "$quoted"
}
Any suggestions of the error?
You probably copied and pasted that from some word processor or website that turned the straight, regular, ASCII quotes " into pretty, curly Unicode quotes “ ”. Bash doesn't understand those. Just type them in by hand to fix the problem.

How do I copy and paste Bash without dollar signs? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
Suppose I have the following code in a StackOverflow response:
$ export FLASK_APP=main.py
$ export FLASK_DEBUG=1
$ python -m flask run
Is there an easy way to copy and paste this without the $ signs, so I can directly paste this into my terminal?
You could do:
. <( sed 's/^\$ //' <<'PASTE'
**paste here**
PASTE
)
Or, make that into a function:
undollar() { . <( sed 's/^\$ //' ); }
Than you use that like
$ undollar<hit enter>
<paste here>
<hit Ctrl+D>
Both of these approaches use the . command, so effects are seen in the current shell: for example with the commands you list, the FLASK_APP and FLASK_DEBUG environment variables remain in the shell.
As noted by Charles Duffy, old versions of bash cannot source a process substitution: see Why source command doesn't work with process substitution in bash 3.2?

Why do double quotes break the ssh statement? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am trying to ssh into my amazon server. I have two ways of doing it, one works and one doesn't, and I'm not sure why the second one does not work.
First way:
ssh -i path-to-pem-file username#public-ip
This works.
Second way:
ssh -i "path-to-pem-file" username#public-ip
This results in "Warning: Identity file "path-to-pem-file" not accessible".
Both of the above commands are run from the terminal on Mac OSX. Why do the double quotes break the statement? thanks.
If your using shell expansion or other special characters their special meanings will not be interpreted when quoted. They are considered literal values.
You can replicate this with the ~ or special character for $HOME
Doesnt work
ssh -i "~/mypemkey.pem" ec2-user#somehost
Works
ssh -i ~/mypemkey.pem ec2-user#somehost
Essentially the ssh application is trying to find a literal file path ~/ instead of /Users/someuser/ when expanded.
Want to see it in action under the hood.... test it!
Create a simple bash script
echo "echo \$1" > test.sh
Execute it
/bin/bash test.sh ~/Desktop
outputs: /Users/phpisuber01/Desktop
/bin/bash test.sh "~/Desktop"
outputs: ~/Desktop

How do I delete this '# ... #' Emacs File? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
There is a file in my home directory that is called #snake#. I want to remove it but none of the regular remove commands will work. How can this "file" be removed without causing any damage, and what type of file is it?
It's an autosave file, it's there in case your computer crashes. You can delete these from emacs quite conveniently. Open up dired (C-x d) and press # to select all of them in the directory. Then x for delete.
Alternatively in a shell, just put the name in quotes, e.g. rm "#snake#"
The "problem" is that the # sign is interpreted as the start of a comment in a shell. Try enclose the file name in quotes, like:
rm "#snake#"

bash history CTRL+R behaviour [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Sometimes I try to search some command by CTRL+R and it's not found,
while I recently used it or search by CTRL+R with success.
Afer I run `history I'm able to find the command again.
Is this behavior is normal?
How it can be changed?
Ctrl+R searches backward from the current position in the history, so if you already moved that position you'll miss the parts toward the end.
e.g.:
themel#kallisti: ~ $ foob
bash: foob: command not found
themel#kallisti: ~ $ barz
bash: barz: command not found
themel#kallisti: ~ $ barq
bash: barq: command not found
themel#kallisti: ~ $ quarg
bash: quarg: command not found
Ctrl+R,bar yields:
(reverse-i-search)`bar': barq
but also moves to that point in history - if you subsequently do Ctrl+R and search for quarg, you won't find it. This is reset by remedied by using end-of-history (M-> by default) to re-set the index.

Resources