Skip to content

Tag: bash

-bash: laravel: command not found

I have installed the composer and move the composer.phar file to /usr/local/bin just follow the following step: Then I edit my ~/.bash_profile file as following: and save the change and excute: But, when I excute the laravel new test command, it returns an error: PS: in /usr/local/bin directory have no larave…

ksh/bash run command line from variable

I set in cmd variable the find syntax: , I use ksh shell/bash so why when I want to run the cmd as the following I not actually activate the find … it’s also not works when I run with double brackets what is the resolution for this? Remark I not want to set the cmd like this ( this

Exec command in Ant only executes first command

I want to list the permission of every script in directory dir/bin. But the below command only runs “ls” in the directory where the script is with below code rather than every script in dir/bin. Since script.xml is there in maindir, it just does a ls inside maindir. There are 2 problems: Performin…

How to stop newline chars from escaping OLD gnu sed command

I am trying to replace a line in a file with multiple lines. When I had only one new line char ( ‘$’n ). it worked fine, however when I use two of them, it escapes my sed and the file wont run anymore. File.txt: DesiredOutput Actual Output Answer Using older BSD sed you can do: This should work wi…

Status after each argument passed to -exec in find

I’m writing a quick script to list all the files in a directory, run a function on each of them, and then print out the status code. Now the status code I would like is of the entire transaction and not the last expression that was executed. For example… Let’s say I have the following files …

Extract desired information from a string in Linux

Below is the string that I get, now I want to extract the two 3840 from this line, what command should I be using in Bash scripting? Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 3840×3840 [SAR 1:1 DAR 1:1], 100072 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc Answer You can pipe i…

Executing a script from a parent directory?

I have a root directory. In there I have ./bin/ In ./bin/ I have some bash scripts like: These scripts must be ran from ./bin, that is, the working directory must be: however, I would like to do: That last line would set the working directory temporarily to ./bin/ and would execute my script found in ./bin an…