terminal

Using PHP to execute terminal commands

泪湿孤枕 提交于 2019-12-13 04:47:22
问题 How can PHP be used to create a number of commands in the terminal? For example, if I want to change the permissions on a folder or a file, I might run Sudo Chmod 777 FileName from the command line. How could I do this with PHP? 回答1: Look at exec , system etc: http://www.php.net/manual/en/book.exec.php Obviously, if you are going to use sudo for root access stuff (not recommended) then you would need to either supply a password somehow or set the user which PHP is running as to not require a

Split Filename Up to Define Variables

感情迁移 提交于 2019-12-13 04:47:13
问题 I have a script I created to help with converting a video then uploading it to our website. Our videos all have a standard format for their filename to help with setting them up correctly (day, month, year; i.e. 09OCT2013.m4v). They get filed into directories from year to month to day (i.e. 2013/oct/09OCT2013/09OCT2013.m4v). Right now, my script opens by asking for user input for the year then month then the actual file name for the folder. What I want to do is take the file that has already

Trouble with Terminal Mac (ENCODING) - Not displaying character from Java >127

不打扰是莪最后的温柔 提交于 2019-12-13 04:44:17
问题 Actually I'm having some trouble with the display encoding in my terminal window on mac. I'm running a simple program in Java: And after the compiling when i run that code I face with this result: The number of the variable z do not match the exact unicode value! All my preferences are set to UTF-8, in the editor and also in my terminal, but I can't find a way to solve this problem! UPDATE: Also here the writing and the compiling of the program: Thanks in advance! 回答1: Using the following

macOS Terminal: `ls` sorts results with capitalised names first

风格不统一 提交于 2019-12-13 04:40:26
问题 How can I fix this default sorting behaviour for ls in the macOS Terminal? I want the results to be case-insensitive and alphabetised. Here is an example to illustrate the current and desired behaviours when running ls in a directory with the files/directories: Apple_, apple, Basket_, basket Current behaviour: Apple_ Basket_ apple basket Desired behaviour: Apple_ apple Basket_ basket Does anyone know how to achieve this? 回答1: You can sort like this: $ mkdir testdir && cd testdir $ touch apple

error: C compiler cannot create executables

核能气质少年 提交于 2019-12-13 04:39:02
问题 I am trying to install Rcplex in R on a macbook and I'm following the instruction at this link http://jrzubizarreta.com/INSTALL. On terminal, in the folder where the unzipped Rcplex directory is, I typed cd /Library/Frameworks/R.framework/Versions/3.4/Resources/library R CMD INSTALL --configure-args="PKG_CFLAGS='-m64 -fPIC' PKG_CPPFLAGS=- I/Applications/CPLEX_Studio_Community129/cplex/include PKG_LIBS='- l/Applications/CPLEX_Studio_Community129/cplex/examples/x86-64_osx/static_pic -m64 -lm

Screencapture -l : illegal option?

不问归期 提交于 2019-12-13 04:33:15
问题 I've seen in many pages here on SO (for example here: https://apple.stackexchange.com/questions/56561/how-do-i-find-the-windowid-to-pass-to-screencapture-l) that you have to use the command: screencapture -l in order to capture a single window given its ID. However when I try to enter screencapture -l into the terminal I get this error: screencapture: illegal option -- l I've checked a reference and actually I can't see -l as a possible attribute for screencapture: http://guides.macrumors.com

Creating and Moving an Invisible file with OS X 10.8 Terminal

两盒软妹~` 提交于 2019-12-13 04:28:54
问题 I'm fairly new to using the terminal, but have so far figured out through various forums how to hide a file from the Finder, but once hidden, I'm obviously unable to move it to the flash drive I want to keep it on, and I can't figure out any way hide the file after it's moved off of the internal drive. I'm using the command line: Computer-name:~ User$ chflags hidden /users/me/desktop/filename.txt How do I move the file once it's hidden, or how would I alter the command to hide the file after

How to fix Mac terminal username format (missing colon and no spacing after the $)?

走远了吗. 提交于 2019-12-13 04:25:18
问题 I get a wrong username format when I launch my terminal. As a newbie, I could notice three errors: 1. a closed bracket ] appears instead of a colon 2. the $ sign is not followed by a single space 3. the first letter or character typed doesn't appear, for e.g. if I type ls, only the s would appear Username: mymac, Computer name: MyMac’s MacBook Air This is a screenshot 回答1: The extra ] can be disabled by : opening the terminal selecting edit menu bar hovering over marks unchecking

How to run mysql commands from terminal?

安稳与你 提交于 2019-12-13 04:19:51
问题 Last night I asked; How to connect mysql to objective c? and i started following the tutorial posted as an answer; I was simply wondering how to login to mysql and run commands from the terminal. I tried mysql -u root -p and it said no command found...I know i can create tables in phpmyadmin but id like to use the command line as well. Should i just run the sql queries in phpmyadmin? 来源: https://stackoverflow.com/questions/24977425/how-to-run-mysql-commands-from-terminal

How to open a powershell terminal with one python script?

感情迁移 提交于 2019-12-13 04:15:47
问题 I am working on a text based game that I run by double clicking on my top level script namely TopLevel.py . I am looking for a way to open two terminals in this script. In the one terminal the main game will be run where damage is done and spells are used etc. In the other terminal I would like to display a list of commands that the user can type in , and I want the latter one to stay there and not close until the game is finished. I am not going to show you the whole top level script (it is