question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I’m converting a bash script to an F# script to fix a problem with regex in the bash script. But after the regex runs, I need to run more code.

I’m trying to run code like shown below, but it’s not doing anything, and it doesn’t output anything. I have confirmed that pwd returns the expected current directory. When I run the same command in a bash script, it works as expected.

// 3. Fetch all the new/modified files into the delivery folder.
list_of_files
|> Seq.iter (fun filePath -> 
    cli {
        Shell BASH
        Command $"git show HEAD:{filePath} | install -D /dev/stdin {delivery_folder}/{repo_name}/{branch_name}/{filePath}"
    }
    |> Command.execute
    |> ignore

    Console.WriteLine $"Downloaded {filePath}"
)

The original bash script looked like this:

IFS="
"
for filename in $list_of_files; do
    trimmed_filename=$(echo ${filename} | xargs)
    git show HEAD:${trimmed_filename} | install -D /dev/stdin ${delivery_folder}/${repo_name}/${branch_name}/${trimmed_filename}
    echo \'${trimmed_filename}\'
done

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ScottHutchinsoncommented, Jul 24, 2023

You could also try that one: Command $"\"git show HEAD:{filePath}\" | \"install -D /dev/stdin {delivery_folder}/{repo_name}/{branch_name}/{filePath}\""

I tried that, but it did not create any files. I’ll see if I can get Powershell to work. Thanks for your help.

1reaction
CaptnCodrcommented, Jul 24, 2023

But thank you for using Fli and don’t hesitate to open further issues when you have any.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting your bash scripts
If you run into problems building, testing or running complex bash scripts, don't lose heart. There are many ways you can help ensure...
Read more >
Bash Shell Script Issues - unix
Bash Shell Script Issues · sourcePath , which is the path to the source files/files being backed up or copied. · backupPath ,...
Read more >
2.3. Debugging Bash scripts
Bash provides extensive debugging features. The most common is to start up the subshell with the -x option, which will run the entire...
Read more >
Error handling in Bash scripts | Enable Sysadmin
If it returns zero, it means there is no error. If it is non-zero, then you can conclude the earlier task has some...
Read more >
scripting - Bash or path problem?
1 Answer 1 ... The issue is most likely that the script does not have the correct value of the environment variable PATH...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found