ANSI sequence to change terminal name [closed] - perl

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 4 years ago.
Improve this question
I use a bash script (konsole-name.sh) to change a terminal name, like this:
#!/usr/bin/bash
echo -en "\e]30;$1\a"
and I wanted to use the same method from a perl script that I use to check the GPU temperature, so that it updates periodically the window title.
Yet I didnt find a way.
I tried both this:
$comm='echo -en "\e]30;T=$t\a"';
`$comm`;
and this, using my bash script:
$comm="konsole-name.sh T=$t";
`$comm`;
there is some way to do it?

The console escape sequences work by printing text to the terminal. In your case, the backticks gobble up the output of the script.
Most likely you just want print "\e]30;$1\a"; from within Perl:
my $title = "Fancy terminal title";
print "\e]30;${title}\a";

Related

How to reset my PATH after breaking it accidentally? [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 1 year ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I think I run something incorrectly trying to add a directory to PATH in fish. Perhaps it was this:
set -g PATH my_foobar_directory "$PATH"
From fish tutorial I now understand that I shouldn't have added the double-quotes.
Better yet, should've used fish_add_path my_foobar_directory.
Lesson learned; however, the change has persisted somewhere, and nothing I try seems to recover the previous state. I also cannot find the previous PATH value — the console logs with it were washed away by copious fish: Unknown command: python etc, from fish_prompt bells & whistles.
Falling back to bash gives me bogus PATH as well — even after set -e PATH.
What do? How do I start over?
So for myself, I solved it like this.
In the process tree, I found a sufficiently long-running process. In my case, cinnamon-session worked — though any not-so-distant fish parent would do.
The idea being that in that process's environment, the previous PATH value could still be intact. It was.
Then basically — let's say the pid was 661 — print environment of pid 661 in fish format:
/bin/tr \0 ' ' < /proc/661/environ
# copy output
Then just pick that output, and feed it into the "universal" variant (fish-specific) of the PATH variable, taking care to erase all other variants:
set -e PATH
set -eg PATH
set -Ux PATH <paste>

Double exclamation in fish shell [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 1 year ago.
Improve this question
In zsh, I can execute them.
$ sleep 1
$ echo !$ # !$ equals 1
$ echo !! # !! equals sleep 1
But I can't execute them in fish shell.
Could tell me why and where the zsh documentation is?
This is history expansion, which has a lot more to it then those simple examples.
Fish supports none of it (and probably never will). The usual workaround is to use keybindings. By default, alt-up and alt-down should go through the history token-wise, so you can press alt-up once to get what is effectively !$.
If you wish to prepend something to a command from history, recall that command, go to the beginning (e.g. with ctrl-a) and insert what you want.
Other possibilities are functions to bind e.g. !! to something to insert the previous command or to make a command called !!.
This is still discussed in fish issue #288, though concensus seems to be against adding history expansion.

How to use the matlab function tar? [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 7 years ago.
Improve this question
I am now want to compress a file name File1.txt which is in the current folder. When I try to use the function tar like:
tar('File1.tgz','File1.txt');
Some error happen.
Undefined variable "File1" or function "File1.tgz".
Error in tar (line 1)
tar(File1.tgz,'File1.txt');
Is it any incorrect part of this?
You forgot to put ''.
Try:
tar('File1.tgz','File1.txt');
In my MatlabR2013a it works without problems.
Matlab example:
%Tar all files in the current directory to the file backup.tgz
tar('backup.tgz','.');

Comments are getting executed when I run the Perl Script [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Some of my perl statements are executed even after commenting. I tried all the delimiter #, /*..*/, //
Does anyone face the same issue or can anyone help me how to solve this issue?
Your question appears to be "How do I create a comment in Perl?"
perlsyn says thusly:
Text from a "#" character until the end of the line is a comment, and is ignored. Exceptions include "#" inside a string or regular expression.
For example,
print "apple\n"; # Keeps the doctor away.
Keep in mind that comments can only be used where whitespace is expected. For example, the following does not contain any comments since the # is part of the string literal.
print "apple # Keeps the doctor away.
orange
";

Searching through Stackoverflow.com from the commandline/bash [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 11 years ago.
Improve this question
As the title says i am looking for a way to search through stackoverflow.com using only the command line specifically bash in linux.
Things I need to accomplish :
I just need to get the top 10 answers for my question or even top 5.
Plain Text Output , i.e. strip
HTML out if possible.
Also I would prefer if you didnt give a answer that required elinks or something similar.
here's a rough script to run from command line that does the job
wget 'http://stackoverflow.com/feeds/tag?tagnames=command-line&sort=newest' -qO - | perl -nle ' print $1 if /\<title[^>]+\>([^<]*)/;'|head
It grabs RSS output for a given tag (command-line here) and sort of parses it.
To be done properly one would probably want to parse XML in a better way or use some perl rss parser.