Linked Questions

133 votes
14 answers
74k views

Is it possible to write a single script file which executes in both Windows (treated as .bat) and Linux (via Bash)? I know the basic syntax of both, but didn't figure out. It could probably exploit ...
Ondra Žižka's user avatar
56 votes
8 answers
202k views

Editor's note: Judging by later comments by the OP, the gist of this question is: How can you convert a file with CRLF (Windows-style) line endings to a LF-only (Unix-style) file in PowerShell? Here ...
Angel_Boy's user avatar
  • 1,078
91 votes
2 answers
21k views

due to a "feature" in Microsoft's Visual Studio, .sln files must have windows style line endings so that the windows explorer could open them in Visual studio. So I need to be able to commit this one ...
akonsu's user avatar
  • 29.7k
28 votes
5 answers
41k views

I've seen answers to the questions, but those answers are not from a windows perspective from what I can tell. Windows uses CRLF, Unix and Linux use LF, macOS uses LF and classic Mac uses CR. I don't ...
13steinj's user avatar
  • 477
6 votes
2 answers
20k views

I need to convert a file from DOS to Unix in PowerShell. I know this can be very much easily done in Unix: dos2unix file newfile
judi's user avatar
  • 99
0 votes
2 answers
7k views

Using Powershell v2 called from a batch file, I want to replace each CRLF in a file with just an LF. If a file only has LF without any CR, then I want all the LF to be left alone. I do not want a ...
Amazon Dies In Darkness's user avatar
1 vote
3 answers
2k views

The scenario where I am stuck is that I have a normal windows text file 'command.txt' which I am copying on remote(unix) server from my local machine(windows) using 'pscp' command from cmd. The file ...
prachi309's user avatar
0 votes
1 answer
2k views

I am using Windows and MobaXterm. I created a .bash_profile file in the ~ directory and the following line alias sbp="source ~/.bash_profile" is the only code in that file. However, when I was ...
Seaky Lone's user avatar
  • 1,089
0 votes
1 answer
1k views

I have some data in Excel file and I need to share it with somebody. The other side has specific requirements to the format: text file, *.dat name, pipe-separated, etc.. So I created a VBA-code to ...
ALC1986's user avatar
0 votes
1 answer
422 views

I use C# to create shell scripts to automate my tasks in Linux. In order to do this, I use below structure: List<string> batchFileLines = new List<string>(); batchFileLines.Add("shell ...
VSB's user avatar
  • 10.5k
0 votes
1 answer
87 views

So I'm trying to compose a string using script shell #!/bin/sh blNumber=1111619832 echo '*'$blNumber+='*.xlsx' I expect the output to be: *1111619832*.xlsx but as a result I get: *+=*.xlsx Btw I ...
Hamza LAHLOU's user avatar
0 votes
1 answer
52 views

I am working on a batch script that produces the deployment shell script according to my input, and I found my generated shell script has EOL \r\n, so I need to add a procedure to convert this file to ...
devildelta's user avatar