Tag Info

Hot answers tagged

6

As per the official Cygwin Installation Page: Installing and Updating Cygwin for 64-bit versions of Windows Run setup-x86_64.exe any time you want to update or install a Cygwin package for 64-bit windows. The signature for setup-x86_64.exe can be used to verify the validity of this binary using this public key. I had a hunch this bash was ...


4

Some of that output will be buffered. You send your Ctrl+C to the remote end which interrupts the running program. The program exists and the shell send the characters to show you the prompt again. Before the prompt is shown your screen will first show all the data that was buffered and already on it's way to you. What you're asking is for the program to ...


4

The /proc file system will list exactly this information: $ ls -l /proc/self/fd total 0 lrwx------ 1 michas users 1 Apr 6 04:44 0 -> /dev/pts/0 lrwx------ 1 michas users 1 Apr 6 04:44 1 -> /dev/pts/0 lrwx------ 1 michas users 1 Apr 6 04:44 2 -> /dev/pts/0 lr-x------ 1 michas users 1 Apr 6 04:44 3 -> /proc/6934/fd $ ls -l /proc/self/fd ...


3

Make sure that you have the DISPLAY-variable set in your cygwin-environment: export DISPLAY=:0.0 after connecting with SSH, check if that shell also knows the correct DISPLAY-variable with: echo $DISPLAY


3

I usually run the output into less so that I can kill it via less instead using the q key. $ cmd | less Example $ cat /dev/urandom | less     After hitting q+Enter it'll quit and return back to your normal terminal, leaving it nice and clean. Why does that happen? The problem you're encountering is that there are buffers (for STDOUT) ...


3

I don't have access to a cygwin system so I can't test this, but since you want to use Perl regexes, why not use Perl? perl -ne 'print "$_\n" for /.+?\.jpg/g;' file.txt or awk '{for(i=1;i<=NF;i++){if($(i)~/.+?\.jpg/){print $(i)}}}' file.txt However, I suspect that you want to match the shortest string of non-whitespace characters that end in .jpg ...


2

This updates the locate database, which will indeed take a long time. It has to traverse every path on the system and then index it appropriately, which requires a lot of work (and a lot of resources). While it's not really possible to speed up population of the database, you can make it less intrusive by increasing the niceness and io-niceness of updatedb. ...


2

Echo is putting newlines between words because it's splitting the input at the spaces, not at the newline. This is also why the eval doesn't work - it sees the first word, containing a ', and doesn't see the end of the line, which contains the closing ' Solution: Change the value of IFS (Internal Field Separator) to not contain spaces or tabs, but just ...


2

Having done some research on terminal emulators today, I feel the need to hail the virtues of xterm. This FAQ documents a lot of the bugs in other terminal emulators which aim to be xterm or VT-100 compatible. You can also use vttest to reveal a lot these issues for yourself. What puts a lot of people off of xterm though is the lack of a menu configuration. ...


2

I believe screen will do this, cygwin maps COM ports to /dev/stty* devices and screen will take a device to connect. From man screen If a tty (character special device) name (e.g. "/dev/ttya") is spec‐ ified as the first parameter, then the window is directly connected to this device. This window type is similar to "screen cu -l ...


2

A Stack Overflow comment discusses the possibility of this being due to having a version of gcc or make that isn't dealing with the unix/Windows path style conflict. A similar problem was had in another situation, which was resolved by ensuring that Cygwin's version of gcc was installed as it was otherwise falling back on something else. If you do not have ...


2

The output of each awk processed line is terminated in a linefeed (\n) which is the Unix/Linux standard. Windows/DOS expects a carriage return followed by a linefeed to mark the end of the line (\r\n). notepad will display all Linux generated files as you are currently seeing them. To resolve, pipe the output of awk through the unix2dos command, which ...


2

This looks like the version that patched shellshock (Subject to other bug variations / patches.) for cygwin bash: Date: Mon, 29 Sep 2014 15:22:43 -0600 https://cygwin.com/ml/cygwin-announce/2014-09/msg00040.html AKA: 4.1.14-7 " This is a minor rebuild which picks up an upstream patch to fix CVE-2014-7169 and all other ShellShock attacks (4.1.13-6 was ...


2

There are several levels of buffering. When you press Ctrl+C, this stops the program from emitting data to the terminal. This doesn't affect data that the terminal emulator hasn't displayed yet. When you're displaying data at very high speed, the terminal can't keep up and will lag. That's what's going on here: displaying text is at lot more expensive than ...


2

According to the POSIX standard, environment variables are just plain strings with no associated data types. However, as an extension, some shells like bash, ksh, ksh93, zsh and others allow their variables be typed, like being numeric, an array. Read-only variables or pre-formatted ones might also be supported. They are commonly typed with either the ...


1

Make sure that you are picking the correct netstat for your platform. which netstat will give you path where it is executing it from.


1

In shell scripting, there is only one data type. Everything is text. Different commands may variously interpret the text to suit their needs: $ [ "1" -eq "01" ] && echo yes || echo no yes $ [ "1" = "01" ] && echo yes || echo no no The first test interprets 1 and 01 as numbers (the second probably as an octal number). The second test treats ...


1

You most likely haven't started the cygwin/X server, or maybe not even installed it, you should do that first, so that there is an actual X Display to connect to. cygwin normally only handles commandline programs and the idle development invorment for Python is X based Alternatively you can use the Windows idle environment for development and run the ...


1

I had same problem with Cygwin. You need to run dos2unix mkdatedir.sh # or whatever your script is called this will remove any dos carriage returns but better to set option igncr see https://cygwin.com/ml/cygwin-announce/2010-08/msg00015.html


1

Thanks to @jensd, @unxnut for helping me. based on your comments I was able to figure out the problem. The solution needed two steps: the DISPLAY variable should be properly set. when ssh'ing to remote server, the -X switch must be on my previous attempts lack one or both of these two conditions. Anyhow, for later users who see this here's are examples ...


1

It should be enough to find a way to kill the cat command. For the following proposals you may need a second ssh connection open. Seldom CTRL+z can be more effective than CTRL+c: it can answer faster. After that you suspend the command you can kill it with kill %1 or whatever is its job number. This in the hope that you are still able to read anything from ...


1

I would attempt to download the script first and then run it through bash. Example $ curl -v https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash -O % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 ...


1

Tip: run set -x to enable tracing mode. Bash prints each command before executing it. Run set +x to turn off tracing mode. + find . '\(' '\)' -exec grep -IH needle '{}' '\;' Notice how the last argument to find is \; instead of ;. You have the same problem with the opening and closing parentheses. In your source, you've quoted the semicolon twice. ...


1

Running bash command using arrays Let try: find /tmp \( -type f -o -type d \) -ls Wow, there is a lot of output... Well, now: cmd_list=(find /tmp \() cmd_list+=(-type f) cmd_list+=(-o -type d) cmd_list+=(\) -ls) "${cmd_list[@]}" Hmm... There seem identical! find /tmp \( -type f -o -type d \) -ls 2>/dev/null | md5sum ...


1

man ssh -L [bind_address:] port:host:hostport Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the ...


1

echo -n '' > /path/to/the/file should replace the file with a 0-byte successor. However, Windows file locking is nearly always a pain only when you don't want it to be. If the program is maintaining an open file handle rather than a series of open-append-close events, this may not work.


1

Don't use for loops for this. By default, as explained by @JennyD, your shell will split on whitespace and not keep the entire line. This is not the case if you read the file into a while loop instead of cat and for: $ while read line; do echo "$line"; done < f1.txt; A=0 A=`expr $A + 1` This will also make the eval run correctly: $ while read line; ...


1

First thing is to compare font paths via xset q, e.g.: $ xset q Font Path: /usr/share/fonts/misc/,/usr/share/fonts/100dpi/,/usr/share/fonts/75dpi/,built-ins (a X font server (XFS) url may also be part of a font path) If needed you can add font paths via xset +fp path. After manipulating font paths you have to call xset rehash. The next thing is to ...


1

I believe XDMCP is using the fonts local to the Solaris system. When you SSH you're using fonts that are local, since in that scenario you're the X server and the Solaris box is the X client. You can use the command xlsfonts to see what fonts are accessible to you on a given system. EDIT #1 - Font path You can find out your system's font path using the ...


1

The file you're using has windows style line feeds (CR) at the end of them (same thing happened to me using Cygwin on Windows XP). Use 'dos2unix.exe' to rectify and you should be ok: $ dos2unix.exe script.sh dos2unix: converting file script.sh to Unix format... Then rerun your script and those error messages should no longer appear.



Only top voted, non community-wiki answers of a minimum length are eligible