shell

Why must I source .bashrc every time I open terminal for aliases to work?

心已入冬 提交于 2021-02-07 08:07:51
问题 Git was working fine. I have created an alias in Git but the issue is when I tried to reopen the terminal, then I need to run . ~/.bashrc every time in the terminal. What is the best way I don't need to provide source every time when I reopen the terminal? What I did? I am trying to add source of the .bashrc file in this file but it is a read-only file. I am not able to add the source of the .bashrc file in this profile. open /etc/profile Added the permission to write in the profile as well,

Why must I source .bashrc every time I open terminal for aliases to work?

断了今生、忘了曾经 提交于 2021-02-07 08:02:20
问题 Git was working fine. I have created an alias in Git but the issue is when I tried to reopen the terminal, then I need to run . ~/.bashrc every time in the terminal. What is the best way I don't need to provide source every time when I reopen the terminal? What I did? I am trying to add source of the .bashrc file in this file but it is a read-only file. I am not able to add the source of the .bashrc file in this profile. open /etc/profile Added the permission to write in the profile as well,

linux g++ compiler redirect stderr and stdout creates empty file

China☆狼群 提交于 2021-02-07 06:54:15
问题 I am redirecting the g++ compiler output(both stderr and stdout) to a file on linux. But it is creating an empty file. I read in some other post that stdout is not flushed after every line. Thats ok, but what about stderr. In my case there are compilation errors running several screens. So, I am interested in stderr output. There is no stdout output created. g++ -c -I ~/cplusplus/boost_1_37_0/boost_1_37_0/ -I ~/cplusplus/niVxWorksDeliver/TEES/ Algorithms.cpp 2> output The above command

Vim: read modeline after opening the file?

。_饼干妹妹 提交于 2021-02-07 06:49:35
问题 I work on a variety of projects and many of them set file-specific vim settings. I have been asked to not have modelines set in .vimrc; is there a way after loading the file to load the modelines settings? So if I open tmp.c with vim: int main(int argc, char* argv[]) { return 0; } /* vim: set expandtab tabstop=4 : */ Is there a command I can run to set the stuff in the modeline? Just doing :set modeline after it is open doesn't do anything. 回答1: After :set modeline , reload your buffer with

Specify which shell Yarn uses for running scripts

折月煮酒 提交于 2021-02-07 06:13:48
问题 My package.json has a script in it like this: "buildTslint": "node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts", Note the {,helpers/}*.ts part, this is called Brace Expansion and is only possible in bash , not sh . When running yarn buildTslint I get the following output: # yarn buildTslint yarn buildTslint v0.22.0 $ node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts error TS6053: File 'node_modules/awesomeLibrary

Any equivalent to subprocess in PHP?

不打扰是莪最后的温柔 提交于 2021-02-07 06:01:50
问题 In Java and Python, you have the ProcessBuilder or subprocess modules that let you easily start a process using unescaped strings e.g. ["ls", "some unescaped directory name"] - they also give you powerful tools like access to read from stdout, stderr. Is there any equivalent feature of PHP that is more intelligent and useful than just exec() ? 回答1: The closest equivalent that gives you access to stdin , stdout , and stderr , with two-way communication, would be proc_open(). Here's the example

How do I detect iPhone on network?

人盡茶涼 提交于 2021-02-07 05:14:52
问题 I am trying to detect if my iPhone is in the same network as my Raspberry Pi. I would like to execute a script when I am at home and my iPhone's presence is registered in my LAN. It seems that when the phone is in standby not even the iphone-sync port (6207/tcp) is found. "/usr/bin/nmap -n -sT -p62078 [my phone's local IP]" shows no host. I wonder what else I could scan for. Obviously the phone is online and ready to accept facetime calls (data via 3G is deactivated). Could I accomplish

How do I detect iPhone on network?

旧街凉风 提交于 2021-02-07 05:11:07
问题 I am trying to detect if my iPhone is in the same network as my Raspberry Pi. I would like to execute a script when I am at home and my iPhone's presence is registered in my LAN. It seems that when the phone is in standby not even the iphone-sync port (6207/tcp) is found. "/usr/bin/nmap -n -sT -p62078 [my phone's local IP]" shows no host. I wonder what else I could scan for. Obviously the phone is online and ready to accept facetime calls (data via 3G is deactivated). Could I accomplish

AJAX - Progress bar for a shell command that is executed

六眼飞鱼酱① 提交于 2021-02-07 04:33:26
问题 I am making use of AJAX on my site and I would like to show users progress of a file that is being downloaded by my server. The download is done by script that outputs a percentage to the shell . I would like to pass this info back to the user using AJAX. How can I do this? Thank you for any help and direction. I hope your solutions do not involve writing to a text file and retrieving that percentage from the text file!! Too much over head I think. EDIT - More Info It is a Linux Shell command

Is there a command similar to iwevent to monitor eth0 state?

断了今生、忘了曾经 提交于 2021-02-07 04:33:26
问题 I want to setup my computer to run certain commands when I join or leave certain networks (ie: Start up Synergy when at work; Start up ssh when on the lan at home so I can sync, etc...). I found iwevent which outputs events to the wireless interface that I can watch. However I can't find an equivalent to watch when eth0 is connected or disconnected. I tried ip monitor but there's so much data outputted I can't make use of it sanely. Is there any command I can use to monitor state changes to