![Putty 中远程命令的输出总是在 80 个字符后被截断](https://linux22.com/image/667796/Putty%20%E4%B8%AD%E8%BF%9C%E7%A8%8B%E5%91%BD%E4%BB%A4%E7%9A%84%E8%BE%93%E5%87%BA%E6%80%BB%E6%98%AF%E5%9C%A8%2080%20%E4%B8%AA%E5%AD%97%E7%AC%A6%E5%90%8E%E8%A2%AB%E6%88%AA%E6%96%AD.png)
我一直在徒劳地尝试以正确的格式获取输出。我正在运行 putty ssh 命令,命令的输出被保存到文件中并传输过去。
忽略它是哪个命令的事实,因为当我在 putty 会话中手动在服务器中运行相同的命令时,输出或将输出重定向到文件会将其置于正确的格式。
命令:
output=$(drush @website.dev --uri=xyz1.com fl)
echo "$output" > xyz1.txt
output=$(drush @website.dev --uri=xyz2.com fl)
echo "$output" > xyz2.txt
output=$(drush @website.dev --uri=xyz3.com fl)
echo "$output" > xyz3.txt
output=$(drush @website.dev --uri=xyz4.com fl)
echo "$output" > xyz4.txt
output=$(drush @website.dev --uri=xyz5.com fl)
echo "$output" > xyz5.txt
如果我运行命令行,我会得到以下格式:
National Blog national_blog Enabled 7.x-3.32 N
e
e
d
s
r
e
v
i
e
w
OpenLayers Test Example openlayers_test_example_fea Disabled 7.x-2.0-
Feature ture beta9
Owl Carousel Settings owl_carousel_feature Enabled 7.x-1.0
Password Policy Feature password_policy_feature Disabled
Promo Block promo_block Disabled 7.x-1.01
Promo Block i18n promo_block_i18n Enabled 7.x-1.02
RH Accolade rh_accolade Disabled 7.x-1.10
RH Accolade Feature rh_accolade_feature Disabled 7.x-1.0
RH Accolade Translatable rh_accolade_translatable Enabled 7.x-1.04
RH Accolades i18n View rh_accolades_i18n_view Enabled 7.x-0.02
RH Accolades View rh_accolades_view Disabled 7.x-1.0
RH Banner View rh_banner_view Enabled 7.x-0.21
Article Content Type rh_basic_page_feature Disabled 7.x-2.07
RH Blog rh_blog Enabled 7.x-2.20 O
v
e
r
r
i
d
d
e
n
我想要获取的格式以及在 Putty 会话窗口中手动运行此命令时获取的内容:
RH Job Search rh_job_search_feature Enabled Overridden
RH Media Feature rh_media_feature Enabled 7.x-1.13 Overridden
Media Page rh_media_page_feature Disabled
RH Metro Image Styles rh_metro_image_styles Enabled 7.x-1.00
RH Notifications Feature rh_notifications_feature Disabled 7.x-1.00
Office Location Content Type rh_office_location_feature Enabled
Office Locator rh_office_locator_feature Enabled 7.x-1.5
Office Locator v2 rh_office_locator_v2_feature Disabled 7.x-1.0
RH Press Release i18n Content Type rh_press_release_i18n_content_type Enabled 7.x-1.00
RH Promo CT rh_promo_content_type Enabled 7.x-1.21
RH Promo Feature rh_promo_feature Enabled 7.x-1.10
RH Promo i18n Feature rh_promo_i18n_feature Disabled 7.x-1.01
RH Promo Translatable CT rh_promo_translatable Disabled 7.x-1.05
RH Promo Views rh_promo_views Enabled 7.x-1.01
RH Promo Views i18n rh_promo_views_i18n Disabled 7.x-1.00
RH Quicktabs Feature rh_quicktabs_feature Enabled 7.x-0.03 Overridden
PS:我甚至尝试加载 Putty 会话,以便打开的 Putty 窗口大小不会限制和切断文本:
putty.exe -load "server session xyz" -m "D:\Projects\Drupal\scripts\daily_feature_lists\commands.txt"
还尝试更改几乎所有的腻子属性,包括关闭自动换行,但似乎对我发送的实际远程命令没有任何效果,只有在打开的终端窗口中才会应用腻子配置。
答案1
COLUMNS
您是否尝试在执行 drush 之前明确设置变量?
例如:
output=$(COLUMNS=120 drush @website.dev --uri=xyz1.com fl)
echo "$output" > xyz1.txt