terminal

bash ps1 only executes a script once on new terminal windows [duplicate]

人盡茶涼 提交于 2019-12-11 02:17:48
问题 This question already has answers here : Why doesn't my bash prompt update? (2 answers) Closed 4 years ago . I have a very simple ps1 script in my .bashrc file, this excutes a random script generator called blah. export PS1="\[$(tput bold)\]\[$(tput setaf 1)\]\\$ \[$(tput sgr0)\] $PWD :: **$(. blah)** ::" the blah script simply should export a random string each time in the shell.... function silly { local RANDOMQUOTE=$[ ($RANDOM % 10 ) ] local fooey=('rand1' 'rand2' 'rand3' 'rand4' 'rand5');

.Net Core open external terminal

☆樱花仙子☆ 提交于 2019-12-11 02:15:40
问题 I'm migrating batch script to .Net core and I'm trying to open another terminal from current terminal and run a command (I don't need stderr o stout). With batch only needs this command: start cmd /K gulp . I'm trying to do the same with .Net core but only found the way to run the command inside current terminal. private static string Run (){ var result = ""; try { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "cmd.exe"; startInfo.Arguments = $"/c \"gulp

BASH: Ctrl+C during input breaks current terminal

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 02:07:26
问题 My Bash version is: GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) . I have a piece of code like this: while true; do echo -n "Set password: " read -s pass1 printf "\n" echo -n "Repeat password: " read -s pass2 printf "\n" if [ $pass1 != $pass2 ]; then echo "Not same." else break fi done If I exit this script with ctrl+c while on the line reading pass2 my terminal stops working properly. user@host:~/bin$ user@host:~/bin$ user@host:~/bin$ user@host:~/bin$No command 'aaaa' found, did

Custom shell only taking one argument

落爺英雄遲暮 提交于 2019-12-11 01:58:14
问题 So I have this code for a shell: #include <stdio.h> #include <stdlib.h> #define MAX_NUM_ARGS 256 #define SIZE 256 void orders(char *command[SIZE]); int main() { char buffer[SIZE]= ""; //char input_args[MAX_NUM_ARGS]; char **input_args = NULL; int i = 0;// counting variable int blah = 0; printf("Welcome to the AY shell.\n"); while(1){ //initialize array of strings //first free any prevously allocated memory if (input_args != NULL) { //memory has been allocated free it for (i = 0; i <MAX_NUM

Decrypting a PHP generated OpenSSL string in Terminal

不问归期 提交于 2019-12-11 01:57:10
问题 This question aids as part two to my previous question. I have come across other threads with similar questions but due to recent changes in PHP (ie. mcrypt removal), I am seeking some advice as to how I'd best go about this using OpenSSL in 2017/18. I have devised the following function in a PHP script. It takes a plain text string and encrypts it. <?php function encrypt( $myString) { $data = $myString; $key = 'B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF'; $iv =

I dont know how Postgresql created user on my mac

时间秒杀一切 提交于 2019-12-11 00:16:28
问题 Two days ago, i started learning postgresql. Most tutorials I followed online were either old or the codes wont just work on my mac. I followed a lot of tutorials that did a lot of totally different things. When i switched on my system today. I noticed Postgresql created a user on my mac. I don't know what this is or maybe i used the wrong CLI code. When I tried viewing the user, I saw this should I delete this user or it has a function? 回答1: postgres user account Creating a user account

C: main not found, but it's there | Compilation error

戏子无情 提交于 2019-12-11 00:02:26
问题 When I compile two .c files like given below I get a really weird error. Code for compiling on terminal gcc -I. -o main.c matrix.c -lblas -lgfortran Error: /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2

Can't open terminal - java.io.IOException: Couldn't create PTY"

纵饮孤独 提交于 2019-12-11 00:00:08
问题 I try to open the terminal in android studio but every time I press on it, it says " java.io.IOException: Couldn't create PTY". How to fix this? 回答1: I solved this problem by open Settings>Tool>Terminal, I found that the shell path is invalid(Maybe this is caused by I update the github version),So I choose another path that lie in another folder which name is git-cmd.exe 来源: https://stackoverflow.com/questions/45258211/cant-open-terminal-java-io-ioexception-couldnt-create-pty

How to redraw the console screen so it would appear as screen was cleared?

浪子不回头ぞ 提交于 2019-12-10 23:49:10
问题 So what I am trying to do it so simulate clearing screen of Eclipse terminal. I know there isn't a real solution for clearing the screen so I know I must use tons of empty lines to clear the screen. The problem is that when I do tons of new line characters the pointer would be at the bottom of the terminal. How would I do this so I would end up with pointer at the top of terminal and entire view would appear clear of any text? So it would look like Aircrack-ng like interface. The screen keep

“bash: __gitdir: command not found” error in terminal

和自甴很熟 提交于 2019-12-10 23:11:33
问题 Whenever I'm working in the command window, I get the error: "bash: __gitdir: command not found" right above the working line (in other words, right after any command, before it prompts for a new one). Any ideas as to what is going on to bring this up? 回答1: You probably have something calling that command in your .bashrc file. Try searching for __gitdir in it: $ grep __gitdir ~/.bashrc Or maybe post its content, and it will probably be easier to help. 回答2: __gitdir is a function supplied by