(Doctrine-Ubuntu) I run $ doctrine-cli.php command and get doctrine-cli.php: command not found.
P
What's the exactly command you're executing? It should be something like this:
php doctrine-cli.php COMMAND
Also php should be available under PATH system variable but in Ubuntu (if you installed PHP by package installer) that's done by default.
Do this in the command line if you just want to execute it:
chmod +x doctrine-cli.php
and optionally
cp doctrine-cli.php doctrine
this way you can do
./doctrine-cli.php [arguments]
and if you did the optional step you can do
./doctrine [arguments]
and if you don't want the ./ do this
export PATH=$PATH:/full/path/to/doctrine/folder
so now you can execute the doctrine command from any folder
What this does is adds the 'execute' permission to the file. If you have a proper shebang on the top of the file everything should execute fine (I imagine it does) and optionally adds the doctrine folder to your PATH so you can execute it from anywhere
Related
During the work, there are a lot of partners in the project, and sometimes I need to switch among different partners a lot, and every time the process:
change the partner name in .env file manually
run docker-compose down in the terminal
run docker-compose up -d in the terminal
run gulp dev --partner <partner name> in the terminal
So my question is :
Would it possible to use one line of command to complete the entire above process (such as in the package.json, "docker": "docker-compose down && docker-compose up -d", then npm run docker means running docker down and up)
Basically the main point should be :
Would it be possible to use command line to open, edit and save a file? (I know I could use command line to open vi, and then to edit inside vi, but here is not the case)
There's certainly methods of text editing from the command line (see sed/awk etc.) My solution to this, would be to have multiple .env files:
e.g. .env.alice; .env.bob; .env.charlie
Then as part of my script I would symbolically link the one I wanted:
ln -sf .env.alice .env
The rest as you described.
I have downloaded the program jq-win64.exe from 'https://stedolan.github.io/jq/' and installed the program in a folder C:\Program Files\jq\ on my computer.
I have also added the PATH to the program to the end of the systemvariable string in Windows 10 : . . . ;C:\Program Files\curl\;C:\Program Files\jq\
In one terminal window in Visual Studio Code I am running a server.
In another terminal window I am trying to execute the command curl -s localhost:3000 | jq
Terminal window 1:
C:\Users\SteinarV\PROFF_JAVASCRIPT\PROJECT\smartHouse
node server.js
API running on port 3000
Terminal window 2:
C:\Users\SteinarV\PROFF_JAVASCRIPT\PROJECT\smartHouse>curl -s localhost:3000 | jq
'jq' is not recognized as an internal or external command,
operable program or batch file
... and do not understand why jq is not recognized.
Can someone help ?
I have downloaded the program jq-win64.exe from 'https://stedolan.github.io/jq/' and installed the program in a folder C:\Program Files\jq\ on my computer.
As you have indicated, you have a file called jq-win64.exe but you are trying to execute the command jq. You either need to rename the file to jq.exe or you need to use the command jq-win64.
For a detailed explanation of how Windows finds and executes a program in your path when you enter a command, see The Windows NT Command Shell: Command Search Sequence. Specifically:
...The shell now searches each directory specified by the PATH environment variable, in the order listed, for an executable file matching the command name. If a match is found, the external command (the executable file) executes...
...If the command name does not include a file extension, the shell adds the extensions listed in the PATHEXT environment variable, one by one, and searches the directory for that file name. Note that the shell tries all possible file extensions in a specific directory before moving on to search the next directory (if there is one)...
You indicate in the comments the same error persists even when the filenames match. Note that each running program has its own set of environment variables, and these aren't updated by global changes. You need to close and reopen cmd.exe windows after making a global change. See also Adding directory to path environment variable in windows. You can use the path command to verify whether a particular terminal session has inherited the PATH variable you defined, thus narrowing your problem.
You indicate that the problem still persists. You need to use the tools available to you to narrow it down further:
Try running the program with its full path:
"C:\Program Files\jq\jq-win64.exe" --help
This will confirm that the program is present where you think it is and can be run from the terminal.
Try running the program with no path and its extension:
jq-win64.exe --help
If this works but running the program without an extension doesn't, you might have set PATHEXT to something that doesn't include ".EXE".
Try setting the path explicitly in the terminal to contain only the program directory and nothing else, then run it with its full extension:
set PATH=C:\Program Files\jq
jq-win64.exe --help
(Note that after this test you'll need to close the terminal window and start a new one to reset the path.)
If this works, perhaps you have a mismatch in your path.
i am new to laravel i just figured out how to install composer laravel etc etc on my local machine MAMP on windows , Now i am confuse with the command on terminal which is
C:\project>mysql -uroot -proot
'mysql' is not recognized as an internal or external command,
operable program or batch file.
How can i fix this ?
setting Environment will solve the issue
Go to Control Panel -> System -> Advanced
Click - Environment Variables
Go to- System Variables find PATH and click on it.
add the path to your mysql\bin folder to the end paths. (ex: E:\xampp\mysql\bin) and add ; end of the line
Close all the command prompts you opens.
Re open and try it.
Setting the PATH to point to the MYSQL bin folder is normally the first thought, but I find that dangerous as things get left lying around when you change software.
I normally create a little batch file in the projects folder or in a folder that it already on your PATH, like this
mysqlpath.cmd
echo off
PATH=C:\mamp\path\to\the\mysql\bin;%PATH%
mysql -v
The mysql -v will output the mysql version number but it is a handy way of knowing that the correct folder has been added to the PATH. This adds the folder to the PATH but only for the life of the command window.
Then just run this from any command window when you want to use MYSQL from the command line
> phppath
You may also like to create one for PHP as well
phppath.cmd
echo off
PATH=C:\mamp\path\to\the\php\;%PATH%
php -v
i am running a cron tab for every 5 minutes,it contains an .sh files which need to be executed ,where that .sh file consists of ruby code....one thing i can't understand that when i am executing the .sh file directly in terminal its get execute,but the same thing in crontab fails..my entry in crontab follows :
1) mysqldump -uroot -p'myPassword' redmine144 > redmine144_$(date +%Y_%m_%d_%H_%M).sql;
2) cd /home/ror/Projects/redmine144/;
source /usr/local/rvm/environments/ruby-1.9.3-p194#redmine144
bundle exec rake "hb:project_progress"
First one to take backup and it is working fine.
Second one to run some ruby rake task(not working form cron tab)
usually crontab output in not directed to stdout so you check your out put in /var/log/cron file which contains the cron logs. you can add the output and redirect the error, for more see http://www.thegeekstuff.com/2012/07/crontab-log/ and check what error pops upp and you'll be able to figure it out...
Making RVM work with cron is really tricky. I'll share a snippet from my own crontab that is proven to work (with system-wide RVM) - just make sure your app path has a .rvmrc specifying the ruby version and gemset.
MAILTO=mymail#gmail.com
SHELL=/bin/bash
? ? ? ? ? source /etc/profile.d/rvm.sh; cd /app/home/path && bundle exec rake whatever_you_need RAILS_ENV=production
SHELL is important.
The MAILTO is there to aid debugging and could be removed later.
Don't forget to substitute your schedule for the question marks.
I am in MySQL and would like to change the current working directory. I tried to execute:
mysql> system cd './my_dir'
However, this does not seem to work. Has anyone run into a similar problem?
System is going to spawn a child process to run a shell command.....
Current working directory is a process level property....so you can't change it in the parent from a child process. That's why it doesn't work.
I briefly scanned the MySQL docs at http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html but didn't see a direct CD command that changes the working directory. I think an adventurous person could write one....
If you want to change your current working directory for a script, then use the && between the CD and script so it will change directory and then if that's successful it will execute the second command.
mysql> SYSTEM cd /home && ls
What you're looking for is the escape to shell command: \!
mysql>\! cd ./my_dir
You can even use it to escape to the shell completely and then come back to the mysql environment.
mysql>\! bash
bash>cd ./my_dir
bash>exit
mysql>SELECT * ALL FROM <table>;