Tag Info

New answers tagged

0

Set the fill path to the vim like this: C:\cygwin64\bin\vim Main.cs -c ":%s#internal#public#ge | update" or /drives/c/cygwin64/bin/vim Main.cs -c ":%s#internal#public#ge | update"


2

This function should looks like: callSINGULAR() { /opt/local/bin/Singular -b "$1" } Because the parameter is first, provided to function


0

Ran into this with Debian Jessie + Cinnamon + lightdm. Going backto wheezy, I find that /etc/profile and ~/.profile gets sourced by /etc/gdm/Xsession. This logic appears to be totally missing in "this" jessie setup. So I grabbed this code and copied to a new file in jessie: /etc/X11/Xsession.d/70fix_lightdm_gpv graeme@jessie:~/Desktop$ cat ...


0

I think you're going to remap certain special characters, because '/' just can't be in a valid POSIX filename. Try this: FILENAME="$(echo "$URL" | tr '//:?+' '_')" echo "Hello!" >"$FILENAME"


0

Create individual files with the desired PATH variable and store them in a directory in your home folder. Example: cat ~/ch_path.d/brew PATH="/usr/local/bin:/(and so on)" export PATH Then you can source whatever path you want source ~/ch_path.d/brew


0

Most likely, your $PATH is set incorrectly. Specify the full path to android, or set your path via something like this: <?php putenv( implode(PATH_SEPARATOR, array('/dir/containing/android', getenv('PATH'))) ); $fname = $_POST['fname']; $fpack = $_POST['fpack']; $email = $_POST['email']; // Create a new Android project var_dump(shell_exec("android ...


0

test -t 0, didn't work in my case, and people here say it's "non-deterministic" or something. I like the solution of wc -c (count bytes), nice and simple. Empty input has 1 byte, whereas a single character e.g. echo "a" | wc -c gives 2 | (read line; if [ $(echo "$line" | wc -c) -gt 1 ]; then echo "$line"; fi) | This output remains pipe-able, thanks to the ...


1

Depending on how complicated your use-case actually is, you can set and/or change a variable for just one command by prefixing the command with the variable's value. For example, 1 prompt> X=1 2 prompt> X=2 some_command arg1 arg2 3 prompt> echo $X the variable X will be 2 inside some_command, but returned back to X=1 on line 3. So you could ...


1

Thanks to @rickfillion: ssh -t me@server.com "cd sub/folders/; bash -l"


0

ssh user@ip cd /path/to/dir SHOULD do it fine OR set it in the ssh_config file for that connection even:


0

In Linux you can easily convert to and from wav. Mpg123 (or mpg321) can convert to wav adding the option -w out.wav. Lame is a popular example for the inverse: wav to mp3. Editing the audio itself can, again, be done in many ways. One very capable audio editor is snd which is available here. Note: snd can even load, edit and save mp3 files directly. I ...


0

If you know the extension, you can use basename $ basename /home/jsmith/base.wiki .wiki base


1

It would be misleading if a call to to the sleep (or associated) function were to report a process state other than sleep. The sleep command calls the sleep (or associated, such as nanosleep) function, and as such, is in the same state as any other sleeping process.


0

Try this with bash builtin commands: #!/bin/bash l=1 # paragraph counter echo -n $l # print paragraph counter without new line while read x; do # read current line from file if [[ $x == "" ]]; then # empty line? echo # print empty line read x # read ...


1

Use the xargs command. To pass the file names from a file to a cp command we can do: cat 'file_name'| args -I % cp % destination_directory But if you want to see the how it would echo then: cat 'file_name' | args -I % echo cp % destination_directory This will just echo.


0

anaconda USES BASH so short of you running sudo chsh -s /usr/bin/zsh $username FIRST it will not look in ~/.zshrc as zsh is installed but not running


2

Because bash does variable expansion before interpreting variable assignment statements. So, since SOMETHING was not previously defined, your command becomes… SOMETHING=1 echo '' …then gets executed.


0

Assigning a variable a value, likeSOMETHING=1, and printing the value of the variable, like echo $SOMETHING, are two separate things that use two separate statements/commands. Usually in a shell script they could take two separate lines. The && allows you to write two separate commands on the same line. It's the same as SOMETHING=1; echo ...


2

If you want to mount the $APPDATA on your Windows host machine to /datadir on the docker container, instead of the below command: docker run -d --name abe -v $APPDATA/Bitcoin:/datadir poliver/bitcoin-abe You can issue: docker run -d --name abe -v //c/Users/YOUR_USER_NAME/$APPDATA/Bitcoin:/datadir poliver/bitcoin-abe //c/Users/PATH_TO_DIR is the key ...


1

I am very 'sorry' to say that I have now found the solution myself. It seems that I did not dig deep enough. I am now using daemon-start-stop supported by most UNIX systems, and it's working as it should. I followed a tutorial on the internet which can be found here: ...


0

You first rename the directory ./testtest to ./this_is_not_a_testthis_is_not_a_test, and then further attepts to rename e.g. ./testtest/weewee.rb will fail because that file is no longer there. You should use find's -depth option to process entries in the directory first, and the directory itself as the last step.


1

If the filename doesn't contain test, you are moving it over itself (as in mv . ./.). It emits the error, but doesn't change anything. Files with test in their names are renamed correctly.


0

Try that: tail -f logfile | grep -q "Server startup in" It will search for the string in logfile and grep exits silently after the first new line that contains the string appears. As soon as the command exits, the string is found and you can continue the script..


0

It look like a carriage return vs newline issue. Your active terminal might not be matching the remote system and some automatic translation might be wrong. You can compare both system using the stty(1) command. From the Expect documentation: In this case, when you press return, it will be translated to a newline. If Expect then passes that to a ...


0

I’ll assume that you are sure that none of your filenames contain newlines, or that you have some way of dealing with that possibility.  First, manipulate your filenames with sed: % command_to_list_filenames | sed 's/.*\.\([0-9][0-9][0-9][0-9]\)\..*/\1.&/' 2001.Could Be A Title.2001.prop.ext1 1989.Another Potential Title.1989.prop.ext2 % The s (substitute) ...


0

Consider these files: $ ls --quoting-style=c -1 *.* "Another Potential Title.1989.prop.ext2" "being there.2000.prop.ext3" "Could Be A Title.2001.prop.ext1" "Yet Another Potential Title.1989.prop.ext2" This sorts on the year: $ ls --quoting-style=c *.* | sort -t. -k2n "Another Potential Title.1989.prop.ext2" "Yet Another Potential Title.1989.prop.ext2" ...


2

Use ulimit -v instead. Explanation: Current libc implementations resize the data segment only for small mallocs, big mallocs use anonymous mmap()ing so the only way to really limit the program is to limit virtual memory instead (-v switch). Hope this helps. PS: I know this question is very old but failed to find a solution with Google so decided to ...


1

Since the dates are in a format where the chronological order is the same as the lexical order you can simply use awk like this: yourcommand | awk '$0 >= "2015-04-20 18:03:00"' It will output: 2015-04-20 18:06:33 H=(bar.net) [111.176.77.1] F=<foo@bar.net> rejected RCPT <service@charanga.com>: relay not permitted


1

In general it is not safe to parse the output of ls(see below) and similarly "*.*". I suggest to use find it protects you from unusual file name with special character. #!/bin/bash #Convert files using ffmpeg OrDir="/Volumes/Misc/To Convert 2/" find "$OrDir" -type f -exec /bin/bash -c \ 'f2=$(basename "$1"); \ ffmpeg -i "$1" -c:v libx264 -crf 19 ...


2

As the directory name contains spaces, you need to quote "$DIR" to prevent spaces from being parsed as word separators. I would also suggest you slightly change the for loop: #!/bin/bash DIR="/Volumes/Misc/To Convert 2" cd "$DIR" for i in *.*; do ffmpeg -i "$i" -your_option "/Volumes/Misc/Converted/${i%.*}.m4v" done


0

Check the GREP_OPTIONS environment variable. Set it to nothing just in case then try again: GREP_OPTIONS=''


0

When you install CygWin you can select additional software. Choose to install curl or wget and optionally gnupg. Then the installation is as easy as: (wget -O - pi.dk/3 || curl pi.dk/3/ || fetch -o - http://pi.dk/3) | bash If you want more control over the installation: http://git.savannah.gnu.org/cgit/parallel.git/tree/README


1

dialog accepts the first character of labels (when in lists such as checkboxes) as a shortcut, and will cycle through matches if the character corresponds to multiple rows. The feature is mentioned in documentation for the program and its library as abbreviation, e.g., (library): dlg_button_to_char Find the first uppercase character in the label, ...


1

how can i write the line that contains such character and also the previous line Use -B1. For example: $ seq 10 >file $ grep -B1 5 file 4 5 If you want to include the file's name, that add -H: $ grep -HB1 5 file file-4 file:5 Combined with find Assuming that you have either GNU find or a modern BSD find, then your complete command can be ...


1

if you don't mind using grep: in tags directory: grep -Hrn 'b3' . -H prints filename (implied when multiple files being searched) -r searches recursively -n prints line number . wildcard Potentially interesting option: grep -C 3 'b3' path/to/files you can adjust the -Context number of lines returned before and after a match (here, it's 3).


0

Lines 5 and 7 are both bad and should be deleted commented out until/unless somebody can figure out what they are supposed to be. Line 5: /Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/Nessus/run/sbin:/opt/X11/bin:/usr/local/bin:/usr/local/sbin simply expresses the value of $PATH as if it were ...


3

Swapping the contents of a variable is like the easiest thing to do in any language. There's no special facility in bash for swapping the contents of the PATH variable because swapping the contents of any variable is so darn easy to do. For example, you could add this to the end of your favorite shell startup script: DEFAULTPATH="$PATH" alias ...


0

This line has an extra single quote at the end. Take that off and try to source the file again. source ~/.bash_profile. PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/Nessus/run/sbin:/opt/X11/bin"'


1

export LESS_TERMCAP_md=$'\E[0;33;5;74m' # begin bold export LESS_TERMCAP_us=$'\E[0;36;5;146m' # begin underline In these two cases, all the colors and attributes are reset (0), the foreground color is switched to yellow/brown (33) or cyan (36), then blinking is turned on (5), and then something else also happens (74 or 146) which are probably undefined ...


0

Fedora configures ls to use entries of the 256-color palette if your $TERM is set accordingly; see your $LS_COLORS variable and the /etc/DIR_COLORS* files. On gnome-terminal's UI you can only configure the first 16 of these. That is, probably the blue and green colors your ls produces are simply not the "standard" blue/green colors, but one of the ...


0

Inside screen or tmux, the value of $TERM needs to begin with screen, not xterm. See Vim not colouring the end of lines when run inside screen for the same question, and also a detailed explanation of the answer.


1

Dru's approach will probably work, although I've not tested it. Two other approaches are to use a combination of sgdisk and parted, or to use sgdisk in a more complex way. Specifically, you could do either of: Use sgdisk -e to move the backup partition table data to the end of the disk, followed by parted {device-file} resize... to resize the partition. ...


0

the problem is with variable inside single quote: sudo debconf-set-selections <<< 'mysql-server-5.6 mysql-server/root_password password $mysql_pass' sudo debconf-set-selections <<< 'mysql-server-5.6 mysql-server/root_password_again password $mysql_pass_again' When I change it to double qoutes "" it is working...


0

This is what I used for sudo to run Ansible under babun: #!/bin/bash count=0 for var in "$@" do (( count++ )) done shift $count exec "$@"


2

You can use the command who -T in your script to determine which port to use for writing. The '+' or '-' character indicates whether the terminal is writable. [lion@FedoraXXI ~]$ who -T lion ? :0 2015-04-24 15:18 (:0) lion + pts/0 2015-04-24 19:58 (:0) lion - pts/1 2015-04-24 21:24 (:0) [lion@FedoraXXI ~]$


1

Thanks to the comments, ##linux channel on freenet network and man mesg I found the answer, which is: myuser $: w 18:45:42 up 17:00, 2 users, load average: 4.10, 3.84, 3.52 USER TTY LOGIN@ IDLE JCPU PCPU WHAT myuser :0.0 01:46 ?xdm? 23:59 0.02s /usr/bin/ck-launch-session /usr/bin/dbus-launch --exit-with-session /usr/bin/i3 ...


0

Suppose that we have a folder full of text files named 000.txt to 181.txt. Here is an example of processing all of them with the same awk script and send them to respective output files (output000.txt - output181.txt): awk 'NR>6{print>("output" FILENAME)}' {000..181}.txt If we are using bash, then {000..181}.txt will expand to the names of our 182 ...


3

see: https://github.com/docker/docker/issues/12590 If you're using git bash on windows, msysgit converts paths like /c/users to c:\users (not something you want because the path inside the boot2docker VM is /c/Users) On cmd.exe/powershell you shouldn't be having this problem.


2

You can run an expect script from your Bash script parted to answer the question. #!/usr/bin/expect eval spawn parted /dev/sda resize 2 0% 100% expect "Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the ...


1

Steam selection By default one stream per stream type will be selected. If you use -map then this default stream selection behavior will be disabled. However, it is generally recommended to explicitly define your filter inputs and outputs instead of relying on the defaults to avoid unexpected stream selection issues. Scale Instead of trunc(oh*a/2)*2 you ...



Top 50 recent answers are included