Tag Info

New answers tagged

0

You want set -q __fish_prompt_hostname without the $ You'll notice, in the fine documentation: set ( -q | --query ) [SCOPE_OPTIONS] VARIABLE_NAMES... # ............................................^^^^


1

Piping output of a command to a variable.. A simple example a bit like yours $ a=$(echo abc | grep -o a) $ echo $a a So in your case $ line=asdf.fr $ a=$(echo $line | grep -Po '.*(?=.fr)') $ echo $a asdf $ Your line failed because it expanded the line variable $line, and executed it which writes an error to stderr and nothing to stdout. All the $ ...


1

With bash, you use an array, and all variables must be properly quoted: ARG1="foo bar baz" ARG3="qux" cmd=( mycmd ) [[ -n "$ARG1" ]] && cmd+=( "$ARG1" ) [[ -n "$ARG2" ]] && cmd+=( "$ARG2" ) [[ -n "$ARG3" ]] && cmd+=( "$ARG3" ) printf "%s\n" "${cmd[@]}" #exec "${cmd[@]}" This will give you the invocation you want: exec mycommand ...


1

so i was looking for a way to mount a usb device and give an unprivileged user the right to create files and manipulate them, since it is impossible to change uid on a linux partition, the solution here is to use bindfs bindfs allow us to mount a directory to another location and alter permission bits sudo mount /dev/sdb1 /mnt here only root can create ...


5

The man page does not list uid or gid options for ext2, 3 and 4 filesystems. On these filesystems the file permissions don't depend on who mounted the filesystem or on mount options, only on the metadata stored within the filesystem.


1

If you run your script with -x (both bash and zsh) you will see that the $(...) code gets interpreted/parsed differently. This is because, as stated in the FAQ, word splitting in zsh is backwards/bash/sh incompatible. You can use SH_WORD_SPLIT to address this difference. Ok, so it is not a word split problem as we have a command substitution, quoting the ...


0

You could simply write a Perl script to handle the job. It's less messy than Bash. Here's an example of such a script. It calculates the file size reduction between the original and compressed file. #!/usr/bin/env perl use strict; use warnings; die "You must define at least 2 files to compare!\n" unless defined $ARGV[0] && defined $ARGV[1]; die ...


-1

not to be a troll, but this is another reason why object oriented shells like powershell and posh are inherenty superior. In powershell the sort doesn't have to be built into the command. Command outputs are objects instead of walls of text. Therefore, one can manuplate them by sorting one or more columns or even calling the methods of individual objects on ...


1

My understanding of the situation is that the Emacs that comes with Cygwin's emacs package runs inside the terminal, and to have Emacs be separate from the terminal, or to have multiple Emacs frames, you need to install the emacs-w32 package. After you do that, everything should just work. You'll also get image and PDF support for Emacs. There's also the ...


0

just tried with babun, which integrated the cygwin internally, taste good to me : ) Download file slightly big, around 250MB. But installation is straight forward, no need to configure anything and it just work! http://babun.github.io/


0

Although the accepted answer and others here do the job, if you have a very large tree, all of them will sort the whole bunch of files. Better would be if we could just list them and keep track of the oldest, without the need to sort at all. Thats why I came up with this alternative solution: ls -lRU $PWD/* | awk 'BEGIN {cont=0; oldd=strftime("%Y%m%d"); } ...


0

Here ya are: 32 Bit Windows 7+: C:\Program Files\Google\Chrome\Application\chrome.exe /new-window https://mail.google.com/mail/?ui=2&view=cm&fs=1&tf=1&shva=1 64 Bit Windows 7+: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe /new-window https://mail.google.com/mail/?ui=2&view=cm&fs=1&tf=1&shva=1 32/64 Bit ...


0

Improved upon Gilles's answer. This version runs inotifywait once and monitors for events (.e.g.: modifiy) thereafter. Such that inotifywait doesn't need to be re-executed upon every event encountered. It's quick and fast!(even when monitoring large directory recursively) inotifywait --quiet --monitor --event modify FILE | while read; do # trim the ...


0

This is one of the first things I do when I set up a new Windows machine: A functional and sleek console in Windows


0

Added in the below which has seemed to work :-) if echo $SSH_ORIGINAL_COMMAND|egrep -e "^scp " > /dev/null 2>&1; then $SSH_ORIGINAL_COMMAND fi


0

Search for apt-get and "non-interactive" or "unattended" You can find an answer here: http://serverfault.com/q/227190


0

In my .bashrc, I have these functions for precisely that purpose: function run_disowned() { "$@" & disown } function dos() { # run_disowned and silenced run_disowned "$@" 1>/dev/null 2>/dev/null } Prefix a command with dos to run it detached from the terminal. The function is written to work with bash and zsh.


2

I don't know, why only every second ffmpeg command is executed, I could not reproduce this on my machine. However, you approach is too complicated. A cleaner solution would be: for bash compatible shells: for i in *.MTS; do ffmpeg -i $i -c:a copy -c:v copy ${i%MTS}mp4 done Please read about the % and related operators in the section Parameter ...


0

Pick one, and either remove the need for, or escape the other. For example, using "" to indicate the string boundaries (which seems easier in this particular case), we first place quotation marks around the string: alias cpu="top -b n 2 -d 0.01 | grep 'Cpu' | tail -n 1 | awk '{print "cpu=" 100.0-$8 "%"}'" Then, we need to escape the inner quotation marks ...


0

Here's what I use in shell scripts. It hides the error message and error code. rm doesnotexist 2> /dev/null || echo > /dev/null


0

We could use a xsl-document doThis.xsl and process the source.xml with xsltproc into a newFile.xml. The xsl is based on the answer to this question. Put this into a doThis.xsl file <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" ...


0

Fyi, using the Tab in bash shortcut would break at the first space it encounters if multiple directories have identical first names. In such cases a user would have to use: cd Adobe\ Creative\ Cloud/ or what I prefer, cd 'Adobe Creative Cloud'


2

Yes. The shell is pointed to by the variable COMSPEC, so you can see it by various ways. For example in Windows: C:\Users\user>set comspec ComSpec=C:\Windows\system32\cmd.exe The default shell in DOS is COMMAND.COM but you can always change it and/or add additional parameters in CONFIG.SYS using SHELL SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P Many ...


0

Because you're not sending in the right way. It's not enough to send only sendevent dev/input/event1 1 116 1 ; sendevent dev/input/event1 1 116 0 Please just try the below one ;) sendevent dev/input/event1 1 116 1 ; sendevent dev/input/event1 0 0 0 ;sendevent dev/input/event1 1 116 0 ;sendevent dev/input/event1 0 0 0


3

A shell is simply a means to access an OS' features/services, and can be either command line i.e. text-based or GUI-based. DOS' shell is thus its command line interface (CLI) and command interpreter (command.com), that displays the standard DOS prompt. The shell generally runs on top of a text terminal, accepting data from a keyboard and displaying output on ...


1

Yes. The shell in DOS is the COMMAND.COM program.


0

The problem is that my git rebase -i wasn't told what editor to use. Thus, it is fixed by setting one. Let's claim that out editor is vim (or nano, or w/e). Then either export GIT_EDITOR=vim (global) or git config --global core.editor "vim" (local) Would solve the problem. CREDIT goes to glenn jackman https://superuser.com/users/4714/glenn-jackman ...


1

The way "> /dev/null" works is that it takes everything that a program will output into the terminal and puts it at /dev/null, where you can put things that you don't want. Getting rid of the text output is done through the thing that received the output (the terminal). If you want to get rid of audio, you'll need to go through the thing that receives the ...


2

All you need is reptyr. It lives on GitHub and has been packaged for Debian since Wheezy, and probably for other GNU/Linux distros, too. It will foreground your disowned process in the current terminal if you invoke it with its process ID (PID). So for example: pgrep -f DISOWNED_PROCESS # to find out the PID of the disowned process reptyr PID ...


1

According to my reading of the fine manual, it looks like Ctrl-W might do what you want.


0

You can do this too: sudo -S <<< "password" command


0

You can try the small script below: cat a.txt | sed 's/[-/a-zA-Z]//g'


3

Your sed one-liner substitution seems to already work as you intend: $ cat t.txt Hello world types="" Mario types="Game" $ sed '1,/types=""/s/types=""/types="program"/' t.txt Hello world types="program" Mario types="Game" It might be worth editing your question to show what you get when you run your sed command (without the -i option so that the results ...


2

You can use grep: grep -oP '(?<=-)([0-9]+\.?)+' a.txt That extracts all version numbers. If a line contains no version (for example javax.annotation) nothing is printed. The regex: (?<=-): first look for a dash (-), but it should not be a part of the match [0-9]+: search for numbers, they should appear at least one or multiple times ([0-9]+\.?)+: ...


1

It isn't possible to perfectly match all of those strings as you've listed them as there's no way to tell the difference between something like "orai18n-" and "-se2.0". If you create a regex that looks for strings of digits and dots that begin with a dash, you'll match all but the "java-se2.0" string pretty well: sed 's/.*-\([0-9\.][0-9\.]*\).*/\1/' ...


-1

set $(find /search/dirname -type f -printf '%T+ %h/%f\n' | sort | head -n 1) && echo $2 find ./search/dirname -type f -printf '%T+ %h/%f\n' prints dates and file names in two columns. sort | head -n1 keeps the line corresponding to the oldest file. echo $2 displays the second column, i.e. the file name.


2

There are only a couple of ways to do it. First one: Open Terminal preferences. In General tab, change Shells open with and select Command (complete path). Fill it with /bin/bash, /bin/zsh or whatever shell you want. Second one: On the terminal type the following: chsh -s /bin/bash Or the shell you want.


0

Problem number 1 is that LC_COLLATE=c is an invalid locale. You need to use a capital C: LC_COLLATE=C. Example: $ LC_COLLATE=c ls-1a ./ ../ .sharp .zharp Sharp sharp szharp zharp ??harp $ LC_COLLATE=c ls-1a ./ ../ .sharp .zharp Sharp sharp szharp zharp ßharp I don't know how to do unicode-aware sorting without sorting filenames starting with a dot on ...


0

ExitOnForwardFailure yes is a good adjunct to the other suggestions. If it connects but can't establish the port forwarding it's just as useless to you as if it hadn't connected at all.


2

I think that https://github.com/fsquillace/pearl-ssh does what you need. I wrote it long time ago before sshrc was born and it has more benefits compared to sshrc: It does not require dependencies on xxd for both hosts (which can be unavailable on remote host) Pearl-ssh uses a more efficient encoding algorithm It is just ~20 lines of code (really easy to ...


0

You haven't assigned a user ID number (what dscl calls UniqueID) to the _jira user, and since file ownership is recorded by user ID, there's no way to chown files to an account without one. Add something like: dscl . create /Users/_jira UniqueID 301 You should also set the user's PrimaryGroupID, and I'd use that to assign it to the _jira group rather than ...


0

Following up on your github comments, I see that the problem was how you use rvm integration into fish. I use this: https://rvm.io/integration/fish curl -L --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish and then add this to config.fish to load the rvm settings into the shell rvm ...


0

Use the 3rd party tool called NirCmd to get additional features like elevation. nircmd elevate Console.exe Put the Nircmd.exe into the Windows directory so that you can run it from all places.



Top 50 recent answers are included